/* Fulfillment Stats — layout tweaks on top of style.css (matches Orders Shipped app shell) */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.fs-main {
  padding-top: 1rem;
}

.fs-date-range {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.fs-date-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0;
}

.fs-date-field-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.fs-date-input {
  width: 100%;
  max-width: 100%;
  padding: 0.4rem 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.fs-date-input:focus {
  outline: none;
  border-color: var(--accent);
}

.fs-tile-panel .panel h2 {
  margin-bottom: 0.25rem;
}

.fs-dataset-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.fs-clear-database-btn:not([hidden]) {
  border-color: var(--accent);
  color: var(--accent);
}

.fs-clear-database-btn:not([hidden]):hover {
  background: var(--bg-input);
  border-color: var(--accent-dim);
  color: var(--text);
}

.fs-tile-visibility {
  margin-top: 0.5rem;
  padding: 0.75rem 0 0;
  border-top: 1px solid var(--border);
}

.fs-tile-visibility-summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  list-style: none;
}

.fs-tile-visibility-summary::-webkit-details-marker {
  display: none;
}

.fs-tile-visibility-summary::before {
  content: "▸ ";
  display: inline-block;
  margin-right: 0.35rem;
  transition: transform 0.15s ease;
  color: var(--text-muted);
}

.fs-tile-visibility[open] .fs-tile-visibility-summary::before {
  transform: rotate(90deg);
}

.fs-tile-visibility-hint {
  margin-top: 0.5rem;
}

.tile-visibility-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.tile-visibility-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
}

.tile-visibility-row input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

/* Tile grid in main — same visual weight as chart area on Orders Shipped */
.fs-main .tiles-board {
  position: relative;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

@media (max-width: 1100px) {
  .fs-main .tiles-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .fs-main .tiles-board {
    grid-template-columns: 1fr;
  }
}

.fs-main .tile.panel {
  max-height: 620px;
  min-height: 0;
  overflow-y: auto;
  transition: box-shadow 0.15s ease, opacity 0.15s ease;
}

.fs-main .tile.panel[data-tile="total-returns"] {
  max-height: none;
}

.fs-main .tile.panel h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.tile--hidden {
  display: none !important;
}

.tile--dragging {
  opacity: 0.55;
}

.tile-drag-handle {
  cursor: grab;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tile:active .tile-drag-handle {
  cursor: grabbing;
}

.tile-drag-handle::before {
  content: "";
  width: 10px;
  height: 16px;
  flex-shrink: 0;
  background: repeating-linear-gradient(var(--border) 0 2px, transparent 2px 4px);
  border-radius: 2px;
  opacity: 0.85;
}

.tile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.tile-header .tile-drag-handle {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}

.tile-hide-btn {
  flex-shrink: 0;
  margin-top: 2px;
  padding: 4px 10px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
}

.tile-hide-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.kpi-detail code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-input);
  padding: 0.15em 0.35em;
  border-radius: 4px;
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.kpi-detail,
.returns-date {
  color: var(--text-muted);
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--bg-input);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-dim));
  transition: width 0.25s ease;
}

.top-list {
  margin: 0;
  padding-left: 1.1rem;
}

.top-list li {
  margin: 0.35rem 0;
}

.tile-drop-indicator {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 5px;
  margin-top: -2px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), #26b3ff);
  pointer-events: none;
  opacity: 0;
  z-index: 30;
  transition: opacity 0.1s ease;
}

.tile-drop-indicator.tile-drop-indicator--visible {
  opacity: 1;
}

.chart-wrap svg text {
  fill: var(--text-muted);
}

.empty {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
  font-size: 0.85rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.return-pct-by-reason {
  margin: 0;
  padding: 0;
  list-style: none;
}

.return-pct-by-reason li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin: 8px 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Modal — align with dashboard panels */
.fs-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.fs-modal[hidden] {
  display: none;
}

.fs-modal .modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.fs-modal .modal-dialog {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  max-height: min(90vh, 640px);
  overflow: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.fs-modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.fs-modal .modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.fs-modal .modal-close {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
}

.fs-modal .modal-close:hover {
  background: var(--bg-input);
  color: var(--text);
}

.fs-modal .modal-body {
  padding: 18px;
}

.fs-modal .dataset-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.fs-modal .dataset-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.fs-modal .dataset-section h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.fs-modal .dataset-file-line {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.fs-modal .dataset-file-name {
  color: var(--text);
  font-weight: 500;
  word-break: break-all;
}
