:root {
  --refresh-green: #0f766e;
  --refresh-green-soft: #e5f3f0;
  --refresh-blue: #2463a7;
  --refresh-blue-soft: #eaf1f9;
  --refresh-amber: #9a650c;
  --refresh-amber-soft: #fbf2df;
  --refresh-red: #b44747;
  --refresh-red-soft: #faeaea;
}

.data-refresh-shell {
  width: min(1320px, calc(100vw - 28px));
}

.refresh-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.refresh-command {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid #cad6d0;
  border-left: 5px solid var(--refresh-green);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(25, 37, 33, 0.06);
}

.refresh-command-heading,
.band-heading,
.refresh-command-actions,
.job-summary-line,
.job-progress-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.refresh-availability {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.mode-switch,
.date-kind-switch {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0;
  margin: 18px 0 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #eef1ee;
}

.mode-switch {
  width: min(100%, 650px);
}

.mode-switch legend,
.date-kind-switch legend {
  display: none;
}

.mode-switch input,
.date-kind-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-switch span,
.date-kind-switch span {
  display: grid;
  min-height: 38px;
  place-items: center;
  padding: 7px 12px;
  border-radius: 5px;
  color: #54605a;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.mode-switch input:checked + span,
.date-kind-switch input:checked + span {
  background: #fff;
  color: var(--refresh-green);
  box-shadow: 0 2px 7px rgba(25, 37, 33, 0.09);
}

.mode-switch input:focus-visible + span,
.date-kind-switch input:focus-visible + span {
  outline: 3px solid rgba(15, 118, 110, 0.2);
}

.date-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.date-controls[hidden] {
  display: none;
}

.date-kind-switch {
  margin: 0;
}

.date-field {
  display: grid;
  gap: 6px;
  min-width: 180px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.date-field[hidden] {
  display: none;
}

.date-field input {
  width: 100%;
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

.date-range-summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.refresh-command-actions {
  justify-content: flex-start;
  margin-top: 18px;
}

.command-message {
  color: var(--muted);
  font-size: 13px;
}

.command-message.is-error {
  color: var(--refresh-red);
  font-weight: 700;
}

.refresh-band {
  margin-top: 26px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.current-job-band {
  border-top: 3px solid var(--ink);
}

.band-heading {
  margin-bottom: 16px;
}

.empty-state {
  padding: 18px 0;
  color: var(--muted);
}

.status-badge {
  flex: 0 0 auto;
  min-width: 62px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--refresh-blue-soft);
  color: var(--refresh-blue);
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.status-badge[data-state="completed"],
.status-badge[data-state="current"] {
  background: var(--refresh-green-soft);
  color: var(--refresh-green);
}

.status-badge[data-state="failed"] {
  background: var(--refresh-red-soft);
  color: var(--refresh-red);
}

.status-badge[data-state="skipped"],
.status-badge[data-state="canceled"] {
  background: var(--refresh-amber-soft);
  color: var(--refresh-amber);
}

.job-summary-line {
  justify-content: flex-start;
  min-height: 34px;
}

.job-summary-line strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.job-progress {
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe5e1;
}

.job-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--refresh-green);
  transition: width 240ms ease;
}

.job-progress-foot {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.job-module-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px 24px;
  margin-top: 14px;
}

.job-module-result {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 12px;
  min-height: 42px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.job-module-result span:last-child {
  color: var(--muted);
  text-align: right;
}

.module-state-list {
  border-top: 1px solid var(--line);
}

.module-state-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.1fr) minmax(260px, 2fr) 100px;
  gap: 20px;
  align-items: center;
  min-height: 78px;
  border-bottom: 1px solid var(--line);
}

.module-state-title {
  display: grid;
  gap: 5px;
}

.module-state-title small,
.module-state-message {
  color: var(--muted);
  font-size: 12px;
}

.waterline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.waterline-point {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.waterline-point span {
  color: var(--muted);
  font-size: 11px;
}

.waterline-point strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.waterline-connector {
  height: 1px;
  position: relative;
  background: #aab7b0;
}

.waterline-connector::after {
  content: "";
  position: absolute;
  top: -3px;
  right: 0;
  width: 7px;
  height: 7px;
  border-top: 1px solid #78867f;
  border-right: 1px solid #78867f;
  transform: rotate(45deg);
}

.module-state-status {
  justify-self: end;
}

.refresh-history-list {
  border-top: 1px solid var(--line);
}

.history-row {
  display: grid;
  grid-template-columns: 160px minmax(180px, 1fr) minmax(240px, 2fr) 90px;
  gap: 16px;
  align-items: center;
  min-height: 62px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.history-row time,
.history-row-meta {
  color: var(--muted);
}

.history-row-result {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.danger-command {
  color: var(--refresh-red);
}

.refresh-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.refresh-dialog::backdrop {
  background: rgba(17, 27, 23, 0.48);
}

.refresh-dialog-panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.dialog-tone {
  color: var(--refresh-amber);
  font-size: 12px;
  font-weight: 800;
}

.refresh-dialog-panel h2 {
  margin-top: 6px;
}

.refresh-dialog-panel p {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.65;
}

.refresh-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

@media (max-width: 820px) {
  .refresh-header,
  .refresh-command-heading,
  .band-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .mode-switch {
    width: 100%;
    grid-auto-flow: row;
  }

  .date-controls,
  .date-kind-switch,
  .date-field {
    width: 100%;
  }

  .job-module-results {
    grid-template-columns: 1fr;
  }

  .module-state-row,
  .history-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px 0;
  }

  .module-state-status {
    justify-self: start;
  }

  .history-row-result {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .job-progress span {
    transition: none;
  }
}

.module-selection {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.module-selection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.module-selection-heading h3 {
  margin: 4px 0 0;
}

.module-selection-help {
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.module-selection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.module-selection-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.module-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 70px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}

.module-choice:has(input:checked) {
  border-color: var(--refresh-green);
  background: #f0f8f5;
}

.module-choice.is-disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.module-choice-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.module-choice-body small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.module-choice-support {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

@media (max-width: 820px) {
  .module-selection-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .module-selection-list {
    grid-template-columns: 1fr;
  }
}