:root {
  --ink: #12303f;
  --muted: #5a7080;
  --line: #dde6ec;
  --field: #f7fafc;
  --brand: #007fb5;
  --brand-dark: #006a98;
  --brand-soft: #e9f5fb;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --ok: #0f8a5f;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  font-size: 15px;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; display: grid; place-items: center; padding: 32px 16px;
  background:
    radial-gradient(900px 480px at 0% 0%, #d8eef8 0%, transparent 60%),
    radial-gradient(800px 520px at 100% 100%, #e3f3ee 0%, transparent 55%),
    #f2f6f9;
}
.panel {
  position: relative; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 20px;
  padding: 36px; width: 100%; max-width: 480px;
  box-shadow: 0 1px 2px #12303f0d, 0 20px 50px -12px #12303f26;
  animation: panel-in .35s ease-out both;
}
/* Indeterminate progress bar shown while a form is being submitted. */
.panel::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 3px; opacity: 0;
  background: linear-gradient(90deg, transparent, var(--brand), transparent); background-size: 40% 100%;
  background-repeat: no-repeat; transition: opacity .2s;
}
.is-submitting .panel::before { opacity: 1; animation: progress 1.1s ease-in-out infinite; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--brand); font-weight: 800; font-size: 18px; letter-spacing: .02em; margin-bottom: 28px; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand span { color: var(--ink); }
h1 { font-size: 24px; line-height: 1.3; margin: 0 0 8px; letter-spacing: -.01em; }
p, li { line-height: 1.6; }
p { color: var(--muted); }
.lead { margin: 0 0 24px; }
strong { color: var(--ink); }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.field { margin-bottom: 18px; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 7px; }
input:not([type=hidden]) {
  width: 100%; height: 48px; padding: 0 14px; border: 1px solid #cdd9e1; border-radius: 11px;
  font: inherit; color: var(--ink); background: var(--field);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder { color: #98a9b5; }
input:hover { border-color: #b5c6d1; }
input:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px #007fb526; }
.has-error input { border-color: #f0a39b; background: var(--danger-soft); }
.password-field { position: relative; }
.password-field input { padding-right: 52px; }
.password-toggle {
  position: absolute; top: 4px; right: 4px; width: 40px; height: 40px; min-height: 0; padding: 0; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 8px; color: var(--muted);
}
.password-toggle:hover { color: var(--brand); background: var(--brand-soft); filter: none; }
.password-toggle .eye-closed, .password-toggle[aria-pressed=true] .eye-open { display: none; }
.password-toggle[aria-pressed=true] .eye-closed { display: block; }

button {
  font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 11px; border: 1px solid transparent; cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible { outline: 3px solid #91d2ed; outline-offset: 2px; }
button:disabled { cursor: progress; }
button:disabled:not(.is-loading) { opacity: .55; }
.primary { background: linear-gradient(180deg, #0a8fc8, var(--brand)); color: #fff; border-color: var(--brand-dark); box-shadow: 0 6px 16px -6px #007fb599; }
.primary:hover:not(:disabled) { background: linear-gradient(180deg, var(--brand), var(--brand-dark)); }
.secondary { background: #fff; border-color: #cdd9e1; color: var(--ink); }
.secondary:hover:not(:disabled) { background: #f5f8fa; border-color: #b5c6d1; }
.danger { color: var(--danger); }
.danger:hover:not(:disabled) { background: var(--danger-soft); border-color: #f0a39b; }
.text-button { background: transparent; color: var(--brand); font-weight: 500; min-height: 40px; }
.text-button:hover:not(:disabled) { background: var(--brand-soft); }
form > button { margin-top: 8px; width: 100%; }
form > .text-button { margin-top: 12px; }
.is-loading::before {
  content: ""; width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}

.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 20px;
  border: 1px solid #fecdca; border-radius: 11px; background: var(--danger-soft); color: var(--danger);
}
.alert p { margin: 0; color: var(--danger); font-size: 14px; }
.alert.is-warning { border-color: #fedf89; background: #fffaeb; color: #b54708; }
.alert.is-warning p { color: #93370d; }
.errorlist { list-style: none; color: var(--danger); font-size: 13px; padding: 0; margin: 6px 0 0; }
.alert .errorlist { margin: 0; }

.account-card, .connection {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px;
}
.account-card { margin: 16px 0 0; background: #fbfdfe; }
.account-card div, .connection-info { display: flex; flex-direction: column; min-width: 0; }
.account-card span:not(.avatar), .connection-info span { color: var(--muted); font-size: 13px; }
.avatar {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 11px;
  background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 16px;
}
.notice { background: var(--brand-soft); border: 1px solid #d3eaf5; padding: 14px 18px; border-radius: 14px; margin: 16px 0; }
.notice p { margin: 0 0 8px; color: var(--ink); font-size: 14px; }
.notice .scope-list { margin-bottom: 12px; }
.notice p:last-child { margin-bottom: 0; }
.consent-panel { padding: 28px; }
.consent-panel .brand { margin-bottom: 18px; }
.consent-panel h1 { font-size: 22px; }
.consent-panel .account-card { padding: 10px 12px; margin-top: 12px; }
.consent-panel .notice { padding: 12px 14px; margin: 12px 0; }
.consent-panel .notice p, .consent-panel .scope-list li { font-size: 13px; line-height: 1.5; }
.consent-panel .scope-list li { margin: 4px 0; }
.consent-panel .actions { margin-top: 14px; gap: 8px; }
.consent-panel .footnote { padding-top: 12px; margin-top: 14px; }
.consent-panel form > .text-button { margin-top: 4px; }
.scope-action { display: inline-block; margin-top: 4px; color: var(--brand-dark); font-weight: 600; line-height: 1.6; }
.scope-action:focus-visible { outline: 3px solid #91d2ed; outline-offset: 3px; }
ul { padding-left: 20px; }
.scope-list { list-style: none; padding: 0; margin: 0; }
.scope-list li { position: relative; padding-left: 28px; margin: 6px 0; font-size: 14px; }
/* Pure-CSS check mark: the CSP blocks data: image URIs. */
.scope-list li::before { content: ""; position: absolute; left: 0; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ok); }
.scope-list li::after {
  content: ""; position: absolute; left: 6.5px; top: 6.5px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.destination { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.destination code {
  overflow-wrap: anywhere; padding: 8px 10px; border-radius: 8px; background: #f2f6f9; color: var(--ink);
  font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.hint { font-size: 13px; margin: 14px 0 0; }
.actions { display: flex; gap: 12px; margin-top: 20px; }
.actions button { flex: 1; }
.status-icon {
  width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 16px; border-radius: 14px;
  background: var(--danger-soft); color: var(--danger);
}
.status-icon .icon { width: 28px; height: 28px; }

.connection { margin-top: 12px; flex-wrap: wrap; }
.connection-info { flex: 1; }
.connection form { margin-left: auto; }
.connection form > button { margin: 0; width: auto; min-height: 38px; font-size: 14px; }
.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 20px;
  border: 1px dashed #c6d5df; border-radius: 14px; background: #fbfdfe;
}
.empty-state .icon { width: 36px; height: 36px; color: var(--brand); margin-bottom: 10px; }
.empty-state p { margin: 4px 0 0; font-size: 14px; }

.footnote {
  display: flex; gap: 8px; align-items: center; border-top: 1px solid #e8eef2; padding-top: 18px; margin: 24px 0 0; font-size: 12px;
}
.footnote .icon { width: 16px; height: 16px; color: var(--ok); }
.legal { max-width: 760px; }
.legal h2 { font-size: 18px; margin: 28px 0 8px; }
.legal nav { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; margin-bottom: 8px; }
.legal a { color: var(--brand); }
.legal .lang { border-top: 1px solid #e8eef2; margin-top: 32px; padding-top: 8px; }
.connector-header { display: flex; align-items: center; gap: 16px; margin: 20px 0; }
.connector-header img { border-radius: 16px; flex: none; }
.connector-header h1 { margin-bottom: 4px; }
.legal code { overflow-wrap: anywhere; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes progress { from { background-position: -40% 0; } to { background-position: 140% 0; } }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .panel { animation: none; }
  .is-loading::before { animation-duration: 2s; }
}
@media (max-width: 480px) {
  body { padding: 16px; place-items: start center; }
  .panel { padding: 24px; border-radius: 16px; }
  h1 { font-size: 21px; }
  .actions { flex-direction: column-reverse; }
  .consent-panel { padding: 20px; }
  .consent-panel .actions { flex-direction: row; }
  .consent-panel .actions button { padding: 0 10px; }
}
