/* MoneySync connect pages. Mobile first: most people arrive from an AI
   phone app's sign-in tab. Colours are the app's own (lib/core/theme.dart);
   every text/background pair here clears WCAG AA 4.5:1. */

:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #2d3436;
  --muted: #5f6a6e;
  --line: #dfe6e9;
  --primary: #3d6bc7;        /* primaryBlueDark: 5.1:1 under white text */
  --primary-text: #ffffff;
  --focus: #3d6bc7;
  --warn-bg: #fef9e3;
  --warn-line: #c9a400;
  --info-bg: #eef4fe;
  --info-line: #5b8def;
  --danger-bg: #fdf0ef;
  --danger-line: #c0392b;
  --danger-text: #a93226;
  --ok: #2e7d32;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --surface: #171b2a;
    --text: #e8ebf2;
    --muted: #a2aac0;
    --line: #2a3147;
    --primary: #5b8def;
    --primary-text: #0b1020;
    --focus: #8bb3f7;
    --warn-bg: #26220f;
    --warn-line: #f4d03f;
    --info-bg: #16203a;
    --info-line: #8bb3f7;
    --danger-bg: #2a1a1a;
    --danger-line: #f2a099;
    --danger-text: #f2a099;
    --ok: #62d37b;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
}

header.brand,
main,
footer {
  max-width: 32rem;
  margin: 0 auto;
  padding: 0 16px;
}

header.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 20px;
  padding-bottom: 4px;
  font-weight: 700;
  font-size: 1.125rem;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 800;
}

main {
  padding-bottom: 24px;
}

h1 {
  font-size: 1.5rem;
  line-height: 1.25;
  margin: 1rem 0 0.75rem;
}

h1:focus {
  outline: none;
}

h2 {
  font-size: 1.0625rem;
  margin: 0.75rem 0 0.25rem;
}

p {
  margin: 0.5rem 0;
}

.muted {
  color: var(--muted);
}

.status {
  min-height: 1.5em;
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.badge {
  display: inline-block;
  margin: 0 0 0.25rem;
  color: var(--ok);
  font-weight: 600;
}

.badge::before {
  content: "\2713\00a0";
}

.sendback {
  font-size: 1rem;
}

.host {
  overflow-wrap: anywhere;
  font-size: 1.0625rem;
}

.card {
  margin: 1rem 0;
  padding: 0.25rem 1rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.list {
  margin: 0.25rem 0 0.5rem;
  padding-left: 1.25rem;
}

.list li {
  margin: 0.25rem 0;
}

.box {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border-left: 4px solid;
}

.box p {
  margin: 0.25rem 0;
}

.box h2 {
  margin-top: 0;
}

.box-warn {
  background: var(--warn-bg);
  border-color: var(--warn-line);
}

.box-info {
  background: var(--info-bg);
  border-color: var(--info-line);
}

.box-danger {
  background: var(--danger-bg);
  border-color: var(--danger-line);
  font-weight: 600;
}

.error {
  color: var(--danger-text);
  font-weight: 600;
}

.button {
  display: block;
  width: 100%;
  min-height: 52px;
  margin: 0.75rem 0;
  padding: 0.875rem 1rem;
  border-radius: 14px;
  border: 2px solid var(--primary);
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button-primary {
  background: var(--primary);
  color: var(--primary-text);
}

.button-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.button-link,
button.button-link {
  display: inline;
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 0.5rem 0.25rem;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

@media (prefers-color-scheme: dark) {
  .button-link,
  button.button-link {
    color: var(--focus);
  }
}

button:disabled,
.button[aria-disabled="true"] {
  opacity: 0.6;
  cursor: progress;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.other-ways {
  margin: 0.5rem 0 1rem;
}

.other-ways summary {
  min-height: 44px;
  padding: 0.625rem 0;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}

@media (prefers-color-scheme: dark) {
  .other-ways summary {
    color: var(--focus);
  }
}

.stack {
  display: flex;
  flex-direction: column;
}

label {
  margin-top: 0.75rem;
  font-weight: 600;
}

input {
  width: 100%;
  min-height: 48px;
  margin-top: 0.25rem;
  padding: 0.625rem 0.75rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

input.code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 1.75rem;
  letter-spacing: 0.5em;
  text-align: center;
}

.code + .button-link {
  align-self: flex-end;
}

.number-line {
  text-align: center;
}

.number {
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
}

.number-big {
  font-size: 3rem;
  font-weight: 800;
  text-align: center;
  margin: 1rem 0;
}

.signed-in {
  overflow-wrap: anywhere;
}

footer {
  padding-top: 8px;
  padding-bottom: 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
