.dashboard-page,
.cases-page {
  --upload-dialog-focus-color: var(--color-brand-accent);
}

.case-upload-eyebrow {
  margin: 0;
  color: var(--cases-accent-ink, var(--color-brand-primary-dark));
  font-size: var(--font-size-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body:has(.dashboard-upload-modal[open]) {
  overflow: hidden;
}

.dashboard-upload-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  padding: var(--space-1);

  .dashboard-upload-switch__button {
    min-height: 2.5rem;
    flex: 1 1 9rem;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    font-weight: 700;
    padding-inline: var(--space-4);

    &:is(:hover, :focus-visible) {
      background: color-mix(in srgb, var(--color-brand-primary) 12%, white);
      color: var(--color-text);
    }

    &.is-active {
      background: var(--color-surface);
      border: var(--border-width) solid color-mix(in srgb, var(--color-brand-primary) 24%, white);
      box-shadow: var(--shadow-sm);
      color: var(--color-text);
    }
  }
}

.dashboard-upload-panels {
  display: grid;
  gap: var(--space-4);
}

.dashboard-upload-panel {
  display: grid;
  gap: var(--space-4);
  border: var(--border-width) solid var(--color-border);
  border-radius: 1rem;
  background: var(--color-surface-muted);
  padding: clamp(var(--space-4), 2vw, var(--space-5));

  .dashboard-upload-panel__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
  }
}

.dashboard-upload-panel__case-picker {
  display: grid;
  gap: var(--space-4);
  border: var(--border-width) dashed color-mix(in srgb, var(--color-brand-primary) 34%, white);
  border-radius: 1rem;
  background: rgb(255 255 255 / 0.66);
  padding: var(--space-4);
}

.dashboard-upload-session__meta,
.dashboard-upload-session__queue {
  display: grid;
  gap: var(--space-2);
}

.dashboard-upload-tracker__actions,
.dashboard-upload-session__item-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.dashboard-upload-session__item-actions {
  margin-top: var(--space-2);
}

.dashboard-upload-modal [data-case-upload-tracker][data-failure-source="external_provider"] {
  border-left: 0.3rem solid var(--color-warning, #b86b00);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--color-warning, #b86b00) 8%, white), transparent 38%),
    var(--color-surface);
}

.dashboard-upload-confirmation__warnings,
.dashboard-upload-confirmation__impacts {
  gap: var(--space-2);
}

.dashboard-upload-confirmation__item {
  border-left: 0.25rem solid color-mix(in srgb, var(--color-brand-primary) 42%, white);
  border-radius: 0.5rem;
  background: rgb(255 255 255 / 0.75);
  padding: var(--space-3);
}

.dashboard-upload-modal {
  width: min(100% - 2rem, 48rem);
  max-height: min(100dvh - 2rem, 52rem);
  border: 0;
  border-radius: 1.5rem;
  background: transparent;
  box-shadow: none;
  color: var(--color-text);
  padding: 0;

  &::backdrop {
    background:
      linear-gradient(180deg, rgb(99 101 105 / 0.48), rgb(99 101 105 / 0.72)),
      var(--color-brand-gradient-soft),
      var(--color-overlay);
    backdrop-filter: blur(8px);
  }

  .dashboard-upload-modal__surface {
    display: grid;
    gap: clamp(var(--space-4), 2vw, var(--space-6));
    overflow: auto;
    border: var(--border-width) solid rgb(51 204 204 / 0.2);
    border-radius: 1.5rem;
    background:
      radial-gradient(circle at top right, rgb(255 255 255 / 0.22), transparent 20rem),
      var(--color-brand-gradient-soft),
      linear-gradient(180deg, rgb(255 255 255 / 0.98), rgb(247 250 252 / 0.98));
    box-shadow: 0 1.5rem 4rem rgb(15 23 42 / 0.24);
    padding: clamp(var(--space-4), 2vw, var(--space-6));
  }

  .dashboard-upload-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);

    h3 {
      margin: var(--space-1) 0 var(--space-2);
      font-size: clamp(1.4rem, 2vw, 1.9rem);
    }
  }

  .dashboard-upload-modal__close {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 2.75rem;
    min-height: 2.75rem;
    border: var(--border-width) solid var(--color-border);
    border-radius: 50%;
    background: rgb(255 255 255 / 0.9);
    color: var(--color-text);
    transition:
      transform var(--transition-fast),
      border-color var(--transition-fast),
      box-shadow var(--transition-fast);

    &:is(:hover, :focus-visible) {
      border-color: var(--upload-dialog-focus-color);
      box-shadow: var(--shadow-sm);
      transform: translateY(-1px);
    }

    svg {
      width: 1.1rem;
      height: 1.1rem;
      fill: none;
      stroke: currentColor;
      stroke-width: 1.8;
      stroke-linecap: round;
      stroke-linejoin: round;
    }
  }

  :is(input, select, button):focus-visible {
    outline: 2px solid var(--upload-dialog-focus-color);
    outline-offset: 3px;
    box-shadow:
      0 0 0 3px rgb(255 255 255 / 0.92),
      0 0 0 6px color-mix(in srgb, var(--upload-dialog-focus-color) 24%, white);
  }
}

@media (max-width: 48rem) {
  .dashboard-upload-panel .dashboard-upload-panel__actions,
  .dashboard-upload-modal .dashboard-upload-modal__header {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-upload-modal {
    width: calc(100% - 1rem);
    max-height: calc(100dvh - 1rem);
  }
}
