/*
 * As telas do Accounts. A cor de cada app chega no style do body (server/brand.ts): --brand é a do
 * cadastro, e --accent-l/--accent-d são as variações com contraste conferido, para o tema claro e o escuro.
 */
@font-face {
  font-family: Geist;
  src: url("/assets/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #fafafa;
  --surface: #fff;
  --line: #e7e7ea;
  --line-2: #d5d5db;
  --text: #0a0a0c;
  --muted: #64646e;
  --subtle: #f3f3f5;
  --danger: #c42b1c;
  --danger-bg: #fdf1ef;
  --house: #2f3437;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 16px 40px -20px rgb(0 0 0 / 0.16);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b;
    --surface: #111114;
    --line: #232328;
    --line-2: #323239;
    --text: #f4f4f5;
    --muted: #a0a0aa;
    --subtle: #18181c;
    --danger: #ff7468;
    --danger-bg: #22100e;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 16px 40px -20px rgb(0 0 0 / 0.7);
  }
}
/* As variações da marca vêm no style do body: é nele que se resolvem. */
body {
  --accent: var(--accent-l);
  --on-accent: var(--on-accent-l);
}
@media (prefers-color-scheme: dark) {
  body {
    --accent: var(--accent-d);
    --on-accent: var(--on-accent-d);
  }
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font:
    15px / 1.5 Geist,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
a {
  color: inherit;
}
h1 {
  font-size: 22px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.022em;
  margin: 0 0 6px;
  text-wrap: balance;
}
p {
  margin: 0 0 12px;
}
.sub,
.hint {
  color: var(--muted);
  font-size: 14.5px;
  margin: 0 0 24px;
  text-wrap: pretty;
}
.hint b {
  color: var(--text);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.small {
  font-size: 13px;
  color: var(--muted);
  margin: 16px 0 0;
  text-align: center;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--subtle);
  border: 1px solid var(--line);
  color: var(--muted);
}

/* A marca: o logo do app, a inicial sobre a cor dele ou o "&" da casa. */
.mark {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 700;
  line-height: 1;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--line);
}
.mark.lg {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  font-size: 24px;
}
.mark.md {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 16px;
}
.mark.sm {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  font-size: 13px;
}
span.mark {
  background: var(--m);
  color: var(--m-on);
}
img.mark {
  position: relative;
  overflow: hidden;
}
/* Só aparece com a imagem quebrada: o navegador não desenha pseudoelemento em imagem que carregou. */
img.mark::before {
  content: attr(data-initial);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--m);
  color: var(--m-on);
}
.mark.house {
  background: var(--house);
  color: #fff;
}
.card > .mark {
  margin-bottom: 22px;
  box-shadow:
    0 0 0 1px var(--line),
    0 12px 28px -10px color-mix(in oklch, var(--brand) 75%, transparent);
}

/* Os botões. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}
.btn.primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.14),
    0 1px 2px rgb(0 0 0 / 0.14);
}
.btn.primary:hover:not(:disabled) {
  background: color-mix(in oklch, var(--accent) 88%, var(--text));
}
.btn.outline {
  border-color: var(--line-2);
  background: var(--surface);
  box-shadow: 0 1px 1px rgb(0 0 0 / 0.03);
}
.btn.outline:hover:not(:disabled),
.btn.ghost:hover:not(:disabled) {
  background: var(--subtle);
}
.btn.danger {
  background: var(--danger);
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  .btn.danger {
    color: #1a0705;
  }
}
.btn.sm {
  width: auto;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13.5px;
}
.btn.sm svg {
  width: 15px;
  height: 15px;
}
.btn.icon {
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--muted);
}
.btn.icon:hover {
  color: var(--text);
  background: var(--subtle);
}
.btn.icon.del:hover {
  color: var(--danger);
}
.btn.icon svg {
  width: 16px;
  height: 16px;
}

/* Os campos. */
label {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  margin: 0 0 6px;
}
input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
input::placeholder {
  color: color-mix(in srgb, var(--muted) 70%, transparent);
}
/* Transparente, e não none: no alto contraste do Windows a sombra some, e o contorno é o foco. */
input:focus-visible {
  outline: 2px solid transparent;
}
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 20%, transparent);
}
.challenge:not(:empty) {
  margin-top: 12px;
}

/* O código: o input invisível por cima das seis casas (views.ts, otpField). */
.otp {
  position: relative;
  margin: 4px 0 0;
}
.otp input {
  position: absolute;
  inset: 0;
  z-index: 1;
  height: 100%;
  opacity: 0;
  font-size: 16px;
  cursor: text;
}
.otp-boxes {
  display: grid;
  grid-template-columns: repeat(3, 1fr) 10px repeat(3, 1fr);
  gap: 8px;
  align-items: center;
}
.otp-boxes i {
  height: 2px;
  border-radius: 2px;
  background: var(--line-2);
}
.otp-boxes span {
  height: 56px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 11px;
  background: var(--surface);
  font-size: 24px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.otp-boxes span.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 20%, transparent);
}
.otp-boxes span.on:empty::after {
  content: "";
  width: 2px;
  height: 40%;
  background: currentColor;
  animation: caret 1s steps(1) infinite;
}
@media (forced-colors: active) {
  .otp-boxes span.on {
    outline: 2px solid CanvasText;
  }
}
@keyframes caret {
  50% {
    opacity: 0;
  }
}

/* O aviso: no cartão, logo abaixo do formulário; na página da conta, flutuando no pé da tela. */
#msg {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 14px;
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--danger) 22%, transparent);
}
#msg.ok {
  background: var(--subtle);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}
#msg:empty {
  display: none;
}

/* ===== As telas de um cartão: login, consentimento, erros ===== */
.card-page {
  position: relative;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 24px;
}
.halo {
  position: absolute;
  top: -250px;
  left: 50%;
  width: 820px;
  height: 560px;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(
    closest-side,
    color-mix(in oklch, var(--brand) 30%, transparent),
    transparent 75%
  );
  pointer-events: none;
}
@media (prefers-color-scheme: dark) {
  .halo {
    background: radial-gradient(
      closest-side,
      color-mix(in oklch, var(--accent) 24%, transparent),
      transparent 75%
    );
  }
}
/* Enquanto a pessoa espera o código, o halo respira. */
body[data-step="code"] .halo {
  animation: breathe 3.6s ease-in-out infinite;
}
@keyframes breathe {
  50% {
    opacity: 0.5;
    scale: 1.08;
  }
}
.card {
  position: relative;
  width: min(400px, 100%);
  padding: 32px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}
/* Com o código pedido, o cabeçalho e as outras formas de entrar saem da frente. */
body[data-step="code"] .step-email {
  display: none;
}
.alt {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.alt.single {
  grid-template-columns: 1fr;
}
.or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 12.5px;
}
.or::before,
.or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.card form .btn {
  margin-top: 12px;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin: 0 0 18px;
  padding: 4px 12px 4px 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--subtle);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.card form .back {
  margin-top: 0;
}
.back:hover {
  color: var(--text);
}
.back svg {
  width: 14px;
  height: 14px;
}
#f-code .hint {
  margin-bottom: 18px;
}
.pair {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.pair .link {
  display: flex;
  gap: 4px;
}
.pair .link i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--line-2);
}
.scopes {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: grid;
  gap: 10px;
  font-size: 14.5px;
}
.scopes li {
  display: flex;
  align-items: center;
  gap: 10px;
}
.scopes li::before {
  content: "";
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background: var(--accent);
  mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.badge-ic {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 18px;
  border-radius: 12px;
}
.badge-ic svg {
  width: 20px;
  height: 20px;
}
.badge-ic.bad {
  background: var(--danger-bg);
  color: var(--danger);
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--danger) 22%, transparent);
}
.badge-ic.ok {
  background: color-mix(in oklch, var(--accent) 12%, transparent);
  color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--accent) 22%, transparent);
}
.card .code {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.foot {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 12.5px;
}
.foot a {
  text-decoration: none;
}
.foot a:hover {
  color: var(--text);
}
@media (max-width: 520px) {
  .card-page {
    justify-content: flex-start;
    padding-top: 56px;
  }
  .card {
    padding: 0 4px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .halo {
    width: 560px;
    top: -300px;
  }
  .foot {
    margin-top: auto;
    padding-top: 32px;
  }
}

/* ===== A página da conta ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 58px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.brandline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
}
.slash {
  color: var(--line-2);
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
}
.crumb {
  color: var(--muted);
  font-weight: 500;
}
.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 700px);
  justify-content: center;
  gap: 56px;
  padding: 44px 32px 40px;
}
.side {
  position: sticky;
  top: 100px;
  align-self: start;
  display: grid;
  gap: 2px;
}
.side a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.side a svg {
  width: 16px;
  height: 16px;
}
.side a:hover,
.side a[aria-current="true"] {
  color: var(--text);
  background: var(--subtle);
}
.side a[aria-current="true"] {
  box-shadow: inset 0 0 0 1px var(--line);
}
.pagehead h1 {
  font-size: 28px;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}
.callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 24px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--subtle);
  color: var(--muted);
  font-size: 13.5px;
}
.callout svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--text);
}
.callout a {
  color: var(--text);
  font-weight: 500;
}
.panel {
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  scroll-margin-top: 82px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px 0;
}
.panel-head:last-child {
  padding-bottom: 20px;
}
.panel-head h2 {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  text-wrap: pretty;
}
.panel-head .btn {
  flex-shrink: 0;
}
.panel-body {
  padding: 18px 24px 22px;
}
.panel-body .value {
  margin: 0;
}
.panel-body .value b {
  font-weight: 500;
  overflow-wrap: anywhere;
}
.panel-body > form {
  margin-top: 18px;
}
.panel-body form .btn {
  margin-top: 12px;
}
.panel-body .hint {
  margin-bottom: 14px;
}
.panel-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-top: 1px solid var(--line);
  background: var(--subtle);
  color: var(--muted);
  font-size: 13px;
}
.panel.danger {
  border-color: color-mix(in oklch, var(--danger) 30%, var(--line));
}
.panel.danger .panel-foot {
  background: var(--danger-bg);
  border-color: color-mix(in oklch, var(--danger) 22%, var(--line));
}
.list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 24px;
}
.list li + li {
  border-top: 1px solid var(--line);
}
.ic {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--muted);
}
.ic svg {
  width: 17px;
  height: 17px;
}
.li-main {
  flex: 1;
  min-width: 0;
}
.li-main b {
  font-weight: 500;
  font-size: 14.5px;
  overflow-wrap: anywhere;
}
.li-main small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.li-act {
  display: flex;
  gap: 2px;
}
.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  vertical-align: 1px;
}
.tag.here {
  border-color: color-mix(in oklch, var(--accent) 40%, transparent);
  background: color-mix(in oklch, var(--accent) 8%, transparent);
  color: var(--accent);
}
.empty {
  margin: 0;
  padding: 16px 24px 22px;
  color: var(--muted);
  font-size: 14px;
}
.account-page .foot {
  margin: 0 0 32px;
}
.account-page #msg {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  translate: -50% 0;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 12px 16px;
  box-shadow:
    inset 0 0 0 1px color-mix(in oklch, var(--danger) 22%, transparent),
    0 16px 40px -12px rgb(0 0 0 / 0.3);
  animation: rise 0.2s ease-out;
  /* Flutua sobre a página: não pode tapar o botão que estiver embaixo. */
  pointer-events: none;
}
.account-page #msg.ok {
  background: var(--text);
  color: var(--bg);
  box-shadow: 0 16px 40px -12px rgb(0 0 0 / 0.3);
}
@keyframes rise {
  from {
    opacity: 0;
    translate: -50% 8px;
  }
}
@media (max-width: 760px) {
  .topbar {
    padding: 0 16px;
  }
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 0 16px 32px;
  }
  .side {
    position: sticky;
    top: 58px;
    z-index: 5;
    display: flex;
    gap: 4px;
    margin: 0 -16px;
    padding: 10px 16px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    scrollbar-width: none;
  }
  .side a {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .pagehead {
    margin-top: 24px;
  }
  .panel {
    scroll-margin-top: 130px;
  }
  .panel-head {
    flex-direction: column;
    gap: 12px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .panel-body,
  .empty {
    padding-left: 16px;
    padding-right: 16px;
  }
  .list li {
    padding: 12px 16px;
  }
  .panel-foot {
    flex-wrap: wrap;
    padding: 12px 16px;
  }
  .panel-foot .btn {
    margin-left: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
