:root {
  color-scheme: light;
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #172033;
  background: #f4f6f8;
  font-synthesis: none;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --surface: #ffffff;
  --border: #dce2ea;
  --muted: #526077;
  --success: #15803d;
  --warning: #b45309;
  --danger: #b91c1c;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(circle at 100% 0, rgb(59 130 246 / 10%), transparent 34%), #f4f6f8;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button,
input,
.provider-card {
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease,
    color 180ms ease,
    opacity 180ms ease,
    transform 180ms ease;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(28px, 6vw, 64px) 0 32px;
}

.page-header,
.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.page-header {
  margin-bottom: 28px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 7px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  color: #0f172a;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 5px;
  color: #0f172a;
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: -0.025em;
}

h3 {
  margin-bottom: 3px;
  font-size: 1.08rem;
}

.subtitle,
.login-copy p,
.toolbar-copy,
.provider-note,
footer {
  color: var(--muted);
  line-height: 1.55;
}

.subtitle {
  max-width: 640px;
  margin-bottom: 0;
}

.login-panel,
.provider-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 32px rgb(15 23 42 / 7%);
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(300px, 1.2fr);
  gap: clamp(24px, 6vw, 72px);
  align-items: end;
  padding: clamp(24px, 5vw, 48px);
}

.login-copy p:last-child {
  margin-bottom: 0;
}

.login-form label,
.credential-form label {
  display: block;
  margin-bottom: 7px;
  color: #334155;
  font-size: 12px;
  font-weight: 750;
}

.field-row {
  display: flex;
  gap: 9px;
}

.field-row input {
  min-width: 0;
}

.field-row button {
  flex: 0 0 auto;
  min-width: 64px;
  white-space: nowrap;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 0 12px;
  color: #0f172a;
  background: #fff;
}

input:hover,
input:focus {
  border-color: var(--primary);
}

.primary-button,
.quiet-button,
.danger-button {
  min-height: 38px;
  border-radius: 9px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 750;
}

.primary-button {
  border: 1px solid var(--primary-hover);
  color: #fff;
  background: var(--primary);
}

.primary-button:hover:not(:disabled) {
  background: var(--primary-hover);
}

.quiet-button {
  border: 1px solid #cbd5e1;
  color: #334155;
  background: #fff;
}

.quiet-button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary-hover);
}

.danger-button {
  border: 1px solid #fecaca;
  color: #991b1b;
  background: #fff7f7;
}

.toolbar {
  align-items: center;
  margin-bottom: 16px;
}

.toolbar-copy {
  margin: 7px 0 0;
  font-size: 12px;
}

.provider-grid {
  display: grid;
  gap: 14px;
}

.provider-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(190px, 0.72fr) minmax(320px, 1.28fr);
  gap: 24px;
  padding: 22px;
}

.provider-card--busy {
  border-color: #93b4f4;
  box-shadow: 0 12px 32px rgb(37 99 235 / 10%);
}

.provider-card--busy button:disabled,
.provider-card--busy input:disabled {
  cursor: progress;
}

.provider-heading {
  display: flex;
  align-items: center;
  gap: 9px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 0 4px rgb(100 116 139 / 13%);
}

.status-dot--authenticated {
  background: var(--success);
  box-shadow: 0 0 0 4px rgb(21 128 61 / 13%);
}

.status-dot--checking {
  animation: status-pulse 1.4s ease-in-out infinite;
}

.status-dot--authentication_required {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgb(180 83 9 / 13%);
}

.status-dot--unavailable {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgb(185 28 28 / 13%);
}

.status-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  color: #334155;
  background: #eef2f7;
  font-size: 10px;
  font-weight: 800;
}

.provider-note {
  margin: 11px 0 0;
  font-size: 12px;
}

.credential-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.provider-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.provider-message {
  min-height: 19px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.provider-message[data-tone="progress"] {
  color: var(--primary-hover);
}

.provider-message[data-tone="success"] {
  color: var(--success);
}

.provider-message[data-tone="warning"] {
  color: var(--warning);
}

.provider-message[data-tone="error"] {
  color: var(--danger);
}

.provider-card--skeleton {
  min-height: 174px;
  overflow: hidden;
}

.skeleton-block {
  border-radius: 10px;
  background: linear-gradient(100deg, #edf1f6 25%, #f8fafc 42%, #edf1f6 58%);
  background-size: 220% 100%;
  animation: skeleton-shift 1.5s ease-in-out infinite;
}

.skeleton-block--summary {
  width: min(100%, 190px);
  height: 72px;
}

.skeleton-block--controls {
  width: 100%;
  height: 92px;
}

.feedback {
  min-height: 24px;
  margin: 14px 0 0;
  color: #9a3412;
  font-size: 13px;
}

.feedback[data-tone="success"] {
  color: var(--success);
}

footer {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  font-size: 12px;
}

@keyframes status-pulse {
  50% {
    opacity: 0.45;
    transform: scale(0.82);
  }
}

@keyframes skeleton-shift {
  to {
    background-position-x: -220%;
  }
}

@media (max-width: 760px) {
  .login-panel,
  .provider-card {
    grid-template-columns: 1fr;
  }

  .credential-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 24px, 1040px);
  }

  .page-header,
  .field-row {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header > button {
    align-self: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
