#dashboard {
  padding: 2rem 0;
}

#dashboard .controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

#dashboard .controls label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted, #4a4a4a);
}

#dashboard .controls label.search-field {
  position: relative;
  flex: 1 1 320px;
  max-width: 480px;
}

#dashboard .controls label.search-field .material-icons-outlined {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted, #9ca3af);
  font-size: 1.25rem;
  pointer-events: none;
}

#dashboard .controls label.search-field input[type="search"] {
  width: 100%;
  padding: 0.65rem 0.75rem 0.65rem 2.75rem;
  border: 1px solid var(--border-subtle, #d8dee5);
  border-radius: 0.75rem;
  font-size: 0.95rem;
  background: var(--surface, #ffffff);
  color: var(--text-strong, #1c2333);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

#dashboard .controls label.search-field input[type="search"]:focus {
  outline: none;
  border-color: var(--accent, #5c6bc0);
  box-shadow: 0 0 0 3px rgba(92, 107, 192, 0.1);
}

#dashboard .controls label.search-field input[type="search"]::placeholder {
  color: var(--text-muted, #9ca3af);
}

#dashboard .controls input[type="date"] {
  padding: 0.4rem 0.6rem;
  border-radius: 0.4rem;
  border: 1px solid var(--border-subtle, #d8dee5);
  background: var(--surface, #ffffff);
  color: inherit;
}

#dashboard .controls input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
}

.bars {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dashboard-view-tabs {
  display: inline-flex;
  align-items: stretch;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  padding: 0.3rem;
  background: var(--surface-elevated, var(--surface, #ffffff));
  border-radius: 0.75rem;
  border: 1px solid var(--border-subtle, #d8dee5);
  box-shadow: 0 6px 16px rgba(20, 37, 63, 0.05);
}

.dashboard-tab {
  flex: 1 1 0;
  border: none;
  background: transparent;
  color: var(--text-muted, #4a4a4a);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.65rem 1.5rem;
  border-radius: 0.6rem;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.dashboard-tab.is-active {
  background: var(--surface-subtle, #eef1f7);
  color: var(--text-strong, #1c2333);
  box-shadow: inset 0 0 0 1px rgba(92, 107, 192, 0.25);
}

.dashboard-tab:focus-visible {
  outline: 2px solid var(--accent, #5c6bc0);
  outline-offset: 2px;
}

.dashboard-panel {
  margin-bottom: 2rem;
  outline: none;
}

.dashboard-panel:focus-visible {
  outline: 2px solid var(--accent, #5c6bc0);
  outline-offset: 4px;
}

.surface-card {
  background: var(--color-surface, #ffffff);
  border-radius: var(--radius-lg, 16px);
  border: 1px solid var(--color-border, #dddddd);
  box-shadow: var(--shadow-card, 0 8px 20px rgba(0, 30, 77, 0.06));
  padding: 1.75rem;
}

.table-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.table-card__toolbar {
  display: flex;
  justify-content: flex-end;
}

.table-scroll {
  border: 1px solid var(--color-border, #dddddd);
  border-radius: var(--radius-md, 12px);
  background: var(--color-surface, #ffffff);
}

.icon-button {
  background: rgba(0, 86, 179, 0.08);
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  cursor: pointer;
  position: relative;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

.icon-button .material-icons-outlined {
  font-size: 20px;
}

.icon-button[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--tooltip-background);
  color: var(--tooltip-text);
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.icon-button[data-tooltip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--tooltip-background);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.icon-button:focus-visible[data-tooltip]::after,
.icon-button:hover[data-tooltip]::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

.icon-button:focus-visible[data-tooltip]::before,
.icon-button:hover[data-tooltip]::before {
  opacity: 1;
}

.icon-button:is(:hover, :focus-visible) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
  background: rgba(0, 86, 179, 0.16);
  outline: none;
}

.icon-button[disabled] {
  background: rgba(102, 102, 102, 0.18);
  color: var(--color-muted);
  cursor: not-allowed;
  box-shadow: none;
}

.icon-button[disabled][data-tooltip]::after,
.icon-button[disabled][data-tooltip]::before {
  display: none;
}

.dashboard-table__cell--code {
  font-family: var(
    --font-mono,
    "Roboto Mono",
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    "Liberation Mono",
    "Courier New",
    monospace
  );
  font-size: 0.85rem;
}

.table-scroll__viewport {
  max-height: 70vh;
  overflow: auto;
  border-radius: inherit;
}

.table-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-surface-elevated, var(--color-surface, #ffffff));
  box-shadow:
    0 1px 0 var(--color-border, #dddddd),
    0 6px 12px rgba(12, 28, 53, 0.08);
}

.table-sticky thead th:first-child {
  z-index: 2;
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1100px;
  font-size: 0.9rem;
}

.dashboard-table thead th {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  font-weight: 600;
  text-align: left;
  color: var(--text-muted, #4a4a4a);
  padding: 0.85rem 1rem;
}

.dashboard-table thead th:not(:first-child) {
  text-align: right;
}

.dashboard-table tbody th,
.dashboard-table tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--color-border, #dddddd);
  vertical-align: top;
}

.dashboard-table tbody th {
  font-weight: 600;
  color: var(--text-strong, #1c2333);
  white-space: nowrap;
}

.dashboard-table tbody tr:nth-child(even) {
  background: rgba(0, 86, 179, 0.03);
}

.dashboard-table tbody tr:hover {
  background: var(--surface-subtle, #f5f7fb);
}

.dashboard-table__cell--numeric {
  text-align: right;
  white-space: nowrap;
}

.dashboard-table__cell--muted {
  color: var(--text-muted, #4a4a4a);
}

.dashboard-table__empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted, #4a4a4a);
}

.bar-row {
  background: var(--surface-elevated, var(--surface, #ffffff));
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: 0 8px 18px rgba(20, 37, 63, 0.08);
  border: 1px solid var(--border-subtle, #d8dee5);
}

.bar-row__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.bar-row__title {
  font-size: 1.1rem;
  margin: 0;
  color: var(--text-strong, #1c2333);
}

.bar-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  color: var(--text-muted, #4a4a4a);
}

.bar-row__meta-chip {
  background: var(--surface-subtle, #f5f7fb);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  line-height: 1.2;
}

.bar-row__meta-chip strong {
  font-weight: 600;
  margin-right: 0.25rem;
  color: var(--text-strong, #1c2333);
}

.bar-row__meta-chip--colored {
  color: #fff;
}

.bar-row__meta-chip--colored strong {
  color: inherit;
}

.bar-row__meta-chip--incoming {
  background: var(--accent, #5c6bc0);
}

.bar-row__meta-chip--wml {
  background: #4a90e2;
}

.bar-row__meta-chip--gmr {
  background: #6c757d;
}

.bar-row__meta-chip--amz {
  background: #f0ad4e;
  color: #1c2333;
}

.bar-row__meta-chip--amz strong {
  color: inherit;
}

.bar-row__meta-chip--additional {
  background: #20c997;
}

.bar-row__track {
  position: relative;
  padding: 0.75rem 0;
}

.bar-row__segments {
  --segment-bar-height: 2.25rem;
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
  background: var(--surface-subtle, #eef1f7);
  border-radius: 0.5rem;
  overflow: visible;
  min-height: var(--segment-bar-height);
  height: var(--segment-bar-height);
  position: relative;
}

.bar-row__segments > .seg:first-child {
  border-top-left-radius: 0.5rem;
  border-bottom-left-radius: 0.5rem;
}

.bar-row__segments > .seg:last-child {
  border-top-right-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
}

.seg {
  position: relative;
  min-width: 0;
  height: 100%;
  transition: width 0.3s ease;
  width: calc(var(--w, 0) * 1%);
  flex: 0 0 auto;
  align-self: stretch;
}

.seg--incoming {
  background: var(--accent, #5c6bc0);
}

.seg--wml {
  background: #4a90e2;
}

.seg--gmr {
  background: #6c757d;
}

.seg--amz {
  background: #f0ad4e;
}

.seg--additional {
  background: #20c997;
}

.seg--hatched {
  background-image: repeating-linear-gradient(
    45deg,
    transparent 0 6px,
    rgba(0, 0, 0, 0.12) 6px 12px
  );
}

.seg__hit {
  appearance: none;
  border: none;
  background: transparent;
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

.seg__hit:focus-visible {
  outline: 2px solid var(--accent, #5c6bc0);
  outline-offset: 2px;
}

.seg__tooltip {
  position: absolute;
  left: 50%;
  top: -0.5rem;
  transform: translate(-50%, -100%);
  background: rgba(28, 35, 51, 0.92);
  color: #fff;
  padding: 0.35rem 0.5rem;
  border-radius: 0.35rem;
  font-size: 0.75rem;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  white-space: nowrap;
  z-index: 5;
}

.seg--incoming .seg__tooltip {
  background: var(--accent, #5c6bc0);
  color: #fff;
}

.seg--wml .seg__tooltip {
  background: #4a90e2;
  color: #fff;
}

.seg--gmr .seg__tooltip {
  background: #6c757d;
  color: #fff;
}

.seg--amz .seg__tooltip {
  background: #f0ad4e;
  color: #1c2333;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.seg--additional .seg__tooltip {
  background: #20c997;
  color: #0e2f25;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.seg:hover .seg__tooltip,
.seg__hit:focus + .seg__tooltip {
  opacity: 1;
}

.guide {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  left: calc(var(--pos) * 1%);
  transform: translateX(-50%);
  opacity: 0.85;
  color: currentColor;
}

.guide::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0.25rem;
  transform: translateX(-50%);
  border-radius: 999px;
  background: currentColor;
}

.guide--min {
  color: var(--danger, #d9534f);
}

.guide--target {
  color: var(--success, #28a745);
}

.dashboard-error {
  padding: 1rem;
  border-radius: 0.5rem;
  background: rgba(217, 83, 79, 0.12);
  color: var(--danger, #d9534f);
  text-align: center;
}

/* ==========================
   COMPACT LAYOUT
   ========================== */

/* Compact bar row */
.bar-row {
  padding: 0.375rem 0.5rem;
  margin-bottom: 0.1875rem; /* Reduced by half again */
}

/* Compact header - single row layout */
.bar-row__header--compact {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.375rem;
  min-height: 40px;
}

/* Title group (article + FNSKU) */
.bar-row__title-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 200px;
  flex: 0 0 auto;
}

.bar-row__article {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-strong, #1c2333);
  line-height: 1.2;
}

.bar-row__fnsku {
  font-size: 0.75rem;
  color: var(--text-muted, #6b7280);
  font-family: "Courier New", monospace;
}

/* Meta icons (compact indicators with Material Icons) */
.bar-row__meta-icons {
  display: flex;
  gap: 0.75rem;
  flex: 0 0 auto;
}

.bar-row__meta-icon {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted, #6b7280);
}

.bar-row__meta-icon .material-icons-outlined {
  font-size: 1.1rem;
  color: var(--accent, #5c6bc0);
}

.bar-row__meta-icon .meta-icon__value {
  font-weight: 600;
  color: var(--text-strong, #1c2333);
}

/* Scrollable chip ribbon */
.bar-row__chip-ribbon {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1 1 auto;
  max-width: 500px;
  padding: 0.25rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle, #d8dee5) transparent;
}

.bar-row__chip-ribbon::-webkit-scrollbar {
  height: 4px;
}

.bar-row__chip-ribbon::-webkit-scrollbar-track {
  background: transparent;
}

.bar-row__chip-ribbon::-webkit-scrollbar-thumb {
  background: var(--border-subtle, #d8dee5);
  border-radius: 2px;
}

.bar-row__chip-ribbon::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted, #9ca3af);
}

/* Compact chips inside ribbon */
.bar-row__meta-chip--compact {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.bar-row__meta-chip--compact strong {
  font-weight: 600;
  margin-right: 0.2rem;
}

/* Expand button */
.bar-row__expand-btn {
  flex: 0 0 auto;
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--text-muted, #6b7280);
  transition:
    color 0.2s ease,
    transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
}

.bar-row__expand-btn:hover {
  color: var(--accent, #5c6bc0);
  background: var(--surface-subtle, #f5f7fb);
}

.bar-row__expand-btn:focus-visible {
  outline: 2px solid var(--accent, #5c6bc0);
  outline-offset: 2px;
}

.bar-row__expand-btn .material-icons-outlined {
  font-size: 1.25rem;
}

/* Details panel (collapsible) */
.bar-row__details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  margin-bottom: 0.375rem;
}

.bar-row__details--expanded {
  max-height: 500px;
}

.bar-row__details .bar-row__meta {
  padding-top: 0.5rem;
}

/* Bar track with horizontal scroll */
.bar-row__track {
  position: relative;
  padding: 0.25rem 0;
  overflow-x: auto;
  overflow-y: visible;
}

.bar-row__track::-webkit-scrollbar {
  height: 6px;
}

.bar-row__track::-webkit-scrollbar-track {
  background: var(--surface-subtle, #eef1f7);
  border-radius: 3px;
}

.bar-row__track::-webkit-scrollbar-thumb {
  background: var(--border-subtle, #d8dee5);
  border-radius: 3px;
}

.bar-row__track::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted, #9ca3af);
}

/* Overflow indicator badge */
.bar-row__overflow-badge {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: #f59e0b;
  color: #ffffff;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 10;
  pointer-events: none;
}

@media (max-width: 900px) {
  #dashboard .controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-view-tabs {
    width: 100%;
  }

  .dashboard-tab {
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
  }

  .bar-row {
    padding: 0.5rem;
  }

  .bar-row__header--compact {
    flex-wrap: wrap;
    min-height: auto;
    gap: 0.5rem;
  }

  .bar-row__title-group {
    flex: 1 1 100%;
    min-width: 0;
    margin-bottom: 0.5rem;
  }

  .bar-row__meta-icons {
    flex: 1 1 auto;
    gap: 0.5rem;
  }

  .bar-row__chip-ribbon {
    flex: 1 1 100%;
    max-width: none;
    flex-direction: column;
    overflow-x: visible;
    overflow-y: visible;
    gap: 0.5rem;
  }

  .bar-row__meta-chip--compact {
    width: 100%;
  }

  .bar-row__expand-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
  }

  .bar-row__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .bar-row__segments {
    min-height: 2rem;
  }

  .dashboard-table-wrapper {
    padding: 1rem;
  }

  .dashboard-table {
    min-width: 720px;
    font-size: 0.85rem;
  }
}
