/* Fetch: counts and Automatic mode, a tab per day, the day's table and the floating selection bar. */

.fetch-open { margin: 0; }

.fetch-summary { display: flex; flex-wrap: wrap; align-items: stretch; gap: 16px; }
.fetch-counts {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-width: min(420px, 100%);
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  background: var(--bg-surface);
}
.fetch-count { display: flex; flex-direction: column; gap: 6px; padding: 14px 18px; border-right: 1px solid var(--border-row); }
.fetch-count:last-child { border-right: 0; }
.fetch-count-label { font-size: var(--text-meta); color: var(--text-tertiary); }
.fetch-count-value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fetch-count-failed .fetch-count-label,
.fetch-count-failed .fetch-count-value { color: var(--danger-fg); }

.automatic-mode-form { display: flex; flex: none; width: 300px; max-width: 100%; margin: 0; }
.automatic-mode {
  display: flex;
  flex: 1;
  align-items: flex-start;
  gap: 14px;
  width: 300px;
  max-width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  background: var(--bg-surface);
  text-align: left;
  white-space: normal;
  cursor: pointer;
}
.automatic-mode-readonly { flex: none; cursor: default; }
.automatic-mode-text { display: flex; flex: 1; flex-direction: column; gap: 4px; }
.automatic-mode-title { font-size: var(--text-table); font-weight: 500; }
.automatic-mode-note { font-size: var(--text-meta); line-height: 1.45; color: var(--text-tertiary); }
.switch { position: relative; flex: none; width: 36px; height: 20px; border-radius: 10px; background: var(--border-disabled); }
.switch span { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.switch-on { background: var(--accent); }
.switch-on span { left: 18px; }
.automatic-mode-readonly .switch { opacity: 0.6; }

.day-tabs { display: flex; flex-wrap: wrap; gap: 6px; font-size: var(--text-base); }
.day-tab {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 12px;
  border-radius: var(--radius-control);
  background: var(--bg-surface);
  box-shadow: inset 0 0 0 1px var(--border-input);
  color: var(--text-primary);
  line-height: 1.25;
  text-decoration: none;
}
.day-tab:hover { color: var(--text-primary); text-decoration: none; background: var(--bg-muted-2); }
.day-tab[aria-current] { background: var(--text-primary); box-shadow: none; color: #fff; }
.day-tab-label { font-weight: 500; white-space: nowrap; }
.day-tab-sub { font-size: 11.5px; opacity: 0.7; white-space: nowrap; }

.fetch-day { display: flex; flex-direction: column; gap: 22px; margin: 0; }
.fetch-table { min-width: 860px; table-layout: fixed; }
.fetch-table th, .fetch-table td { padding-left: 9px; padding-right: 9px; }
.fetch-table th:first-child, .fetch-table td:first-child { padding-left: 18px; }
.fetch-table th:last-child, .fetch-table td:last-child { padding-right: 18px; text-align: right; }
.fetch-table td { padding-top: 12px; padding-bottom: 12px; }
/* The design's grid: 24px 1.4fr 1.2fr 1fr 1fr 1.1fr 70px with 14px gaps. */
.fetch-table th:nth-child(1) { width: 47px; }
.fetch-table th:nth-child(2) { width: 21.5%; }
.fetch-table th:nth-child(3) { width: 18.7%; }
.fetch-table th:nth-child(4),
.fetch-table th:nth-child(5) { width: 15.7%; }
.fetch-table th:last-child { width: 97px; }
.fetch-table-scheduled th:nth-child(2) { width: 18%; }
.fetch-table-scheduled th:nth-child(3) { width: 14%; }
.fetch-table .select input {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin: 0;
  border-radius: 4px;
  background: #fff;
  box-shadow: inset 0 0 0 1.5px #c9c7c0;
  appearance: none;
  cursor: pointer;
}
.fetch-table .select input:checked { background: var(--accent); box-shadow: none; }
.fetch-table .select input:checked::after { content: "\2713"; color: #fff; font-size: 11px; line-height: 1; }
.fetch-table .select input:focus-visible { box-shadow: var(--focus-ring); }
.fetch-table .select input:disabled { background: var(--bg-muted); cursor: not-allowed; }
.fetch-table tbody tr:has(.select input:checked) td { background: oklch(0.985 0.008 195); }
.fetch-table .time { font-size: var(--text-base); font-weight: 500; }
.fetch-at { font-size: var(--text-meta); color: var(--text-secondary); }
.booked-late { color: var(--warning-fg); font-weight: 500; }

.source { display: block; font-size: var(--text-meta); }
.source-running { color: var(--text-primary); }
.source-failed { color: var(--danger-fg); }
.source-muted { color: var(--text-muted); }
.progress { display: block; width: 80px; height: 3px; margin-top: 4px; border-radius: 2px; background: var(--border-card); overflow: hidden; }
.progress span { display: block; width: 55%; height: 100%; background: var(--accent); }
.found-text { display: block; font-size: var(--text-meta); font-weight: 500; }
.found-done { color: oklch(0.45 0.1 155); }
.found-failed { color: var(--danger-fg); }
.found-muted { color: var(--text-muted); font-weight: 400; }
.found .table-sub { font-size: 11.5px; color: var(--text-tertiary); }
.action .muted { white-space: nowrap; }
.row-fetch-form { display: none; }

.selection-bar {
  position: sticky;
  bottom: 20px;
  z-index: 10;
  display: flex;
  align-self: center;
  align-items: center;
  gap: 16px;
  padding: 8px 8px 8px 18px;
  border-radius: var(--radius-card);
  background: var(--text-primary);
  color: #fff;
  font-size: var(--text-base);
  box-shadow: var(--shadow-float);
}
.selection-bar[hidden] { display: none; }
.selection-bar strong { font-weight: 600; }
.selection-bar-note { color: var(--text-faint); }
.selection-bar-clear { padding: 0; border: 0; background: none; color: #c9c7c0; font-size: var(--text-meta); cursor: pointer; }
.selection-bar-clear:hover { color: #fff; text-decoration: underline; }
.selection-bar-submit { background: #fff; color: var(--text-primary); }
.selection-bar-submit:hover { background: var(--bg-muted-3); color: var(--text-primary); }
.fetch-noscript { display: flex; justify-content: flex-end; }

@media (max-width: 48rem) {
  .fetch-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fetch-count:nth-child(2) { border-right: 0; }
  .automatic-mode-form, .automatic-mode { width: 100%; }
  .selection-bar-note { display: none; }
}
