:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #5c6b7f;
  --line: #dfe7f2;
  --brand: #153965;
  --brand-2: #1d75cd;
  --accent: #3b8f6e;
  --bg: #f4f7fb;
  --danger: #b42318;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(140deg, rgba(21, 57, 101, 0.96), rgba(29, 117, 205, 0.82)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.22'%3E%3Cpath d='M0 120c30-22 55-22 80 0s50 22 80 0'/%3E%3Cpath d='M0 72c30-22 55-22 80 0s50 22 80 0'/%3E%3Cpath d='M0 24c30-22 55-22 80 0s50 22 80 0'/%3E%3C/g%3E%3C/svg%3E");
}

.panel {
  width: min(100%, 520px);
  min-height: 460px;
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(6, 22, 45, 0.24);
  padding: 32px;
}

.brand-row {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  display: block;
  border-radius: 12px;
  object-fit: cover;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand-2);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.16;
  letter-spacing: 0;
}

.state { display: none; }
.state.active { display: block; }

#loading.active {
  display: grid;
  justify-items: start;
  gap: 18px;
  padding-top: 24px;
}

.loader {
  width: 38px;
  height: 38px;
  border: 4px solid #d8e7f6;
  border-top-color: var(--brand-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.lede {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.form.active {
  display: grid;
  gap: 12px;
}

label {
  font-size: 14px;
  font-weight: 700;
  color: #263548;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  font: inherit;
  outline: none;
}

input:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(29, 117, 205, 0.16);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.icon-button {
  min-width: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--brand);
  font-weight: 800;
  cursor: pointer;
}

.primary {
  min-height: 48px;
  margin-top: 12px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.primary:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.message-action[hidden] {
  display: none;
}

.message-state.active {
  display: block;
  padding-top: 12px;
}

.error { color: var(--danger); }

@media (max-width: 560px) {
  .shell { padding: 16px; align-items: stretch; }
  .panel { min-height: auto; padding: 24px; }
  .brand-row { align-items: flex-start; }
  h1 { font-size: 24px; }
}
