/* Hallmark · macrostructure: Workbench · genre: modern-minimal
 * theme: custom (violet 288° from the Wekoya mark) · tone: utilitarian
 * nav: N9 edge-aligned minimal · footer: Ft2 inline single line · enrichment: none
 */

@import url("/styles/tokens.css");

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

html,
body {
  /* clip, never hidden — hidden on the root kills position: sticky */
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.15;
  margin: 0;
  text-wrap: balance;
  /* A long unbroken model id must not push the page sideways. */
  overflow-wrap: anywhere;
  min-width: 0;
}

h1 {
  font-size: var(--text-2xl);
}
h2 {
  font-size: var(--text-lg);
}
h3 {
  font-size: var(--text-base);
}

p {
  margin: 0;
  max-width: var(--measure);
}

a {
  color: var(--color-accent-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  /* Instant. Never transitioned — a keyboard user must not wait for it. */
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================ shell ==================================== */

.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* N9 — edge-aligned minimal. Brand hard-left, account hard-right, nothing
   centred, no CTA button pretending to be navigation. */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-lg);
  border-bottom: var(--rule-hair) solid var(--color-rule);
  background: var(--color-paper);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  text-decoration: none;
  color: inherit;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand img {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: block;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.topbar-email {
  font-size: var(--text-sm);
  color: var(--color-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 24ch;
}

.tabs {
  display: flex;
  gap: var(--space-2xs);
  padding: 0 var(--space-lg);
  border-bottom: var(--rule-hair) solid var(--color-rule);
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--color-paper);
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: none;
  padding: var(--space-sm) var(--space-sm);
  font-size: var(--text-sm);
  color: var(--color-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--dur-short) var(--ease-out);
}

.tab:hover {
  color: var(--color-ink);
}

.tab[aria-current="page"] {
  color: var(--color-ink);
  border-bottom-color: var(--color-accent);
  font-weight: 500;
}

.main {
  flex: 1;
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg) var(--space-3xl);
}

/* Ft2 — inline single line. */
.footer {
  border-top: var(--rule-hair) solid var(--color-rule);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  align-items: baseline;
  font-size: var(--text-xs);
  color: var(--color-muted);
}

/* ============================ panels =================================== */

/* One containment layer only. Panels never nest inside panels. */
.panel {
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-lg);
  background: var(--color-paper);
  padding: var(--space-lg);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* Deliberately not three equal columns. The balance panel is the subject; the
   plan sits beside it at two-thirds width. */
.split {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
}

@media (max-width: 52rem) {
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ============================ the figure =============================== */

.figure {
  font-family: var(--font-mono);
  font-size: var(--text-figure);
  font-weight: 500;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  overflow-wrap: anywhere;
}

.figure-label {
  font-size: var(--text-xs);
  color: var(--color-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.figure-note {
  font-size: var(--text-sm);
  color: var(--color-muted);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

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

.small {
  font-size: var(--text-sm);
}

/* ============================ callout ================================== */

/* The orange from the mark, doing semantic work. Never decoration. */
.callout {
  border: var(--rule-hair) solid var(--color-action-edge);
  background: var(--color-action-soft);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
}

.callout[data-tone="info"] {
  border-color: var(--color-accent-edge);
  background: var(--color-accent-soft);
}

.callout[data-tone="critical"] {
  border-color: var(--color-critical);
  background: var(--color-critical-soft);
}

.callout-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-action);
  margin-top: 0.5em;
  flex: none;
}

.callout[data-tone="info"] .callout-dot {
  background: var(--color-accent);
}
.callout[data-tone="critical"] .callout-dot {
  background: var(--color-critical);
}

/* ============================ buttons ================================== */

.btn {
  --btn-bg: var(--color-accent-deep);
  --btn-fg: var(--color-on-accent);
  --btn-edge: transparent;
  appearance: none;
  border: var(--rule-hair) solid var(--btn-edge);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  /* A clickable label never wraps to two lines. */
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  transition:
    background-color var(--dur-short) var(--ease-out),
    transform var(--dur-instant) var(--ease-out);
}

.btn:hover:not(:disabled),
.btn.is-hover {
  --btn-bg: var(--color-accent);
}

.btn:active:not(:disabled),
.btn.is-active {
  --btn-bg: var(--color-accent-press);
  transform: translateY(1px);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn[data-variant="quiet"] {
  --btn-bg: transparent;
  --btn-fg: var(--color-ink);
  --btn-edge: var(--color-rule);
}

.btn[data-variant="quiet"]:hover:not(:disabled) {
  --btn-bg: var(--color-paper-2);
  --btn-fg: var(--color-ink);
}

.btn[data-variant="danger"] {
  --btn-bg: transparent;
  --btn-fg: var(--color-critical);
  --btn-edge: var(--color-critical);
}

.btn[data-variant="danger"]:hover:not(:disabled) {
  --btn-bg: var(--color-critical-soft);
}

.btn[data-state="loading"] {
  pointer-events: none;
}

.btn[data-state="loading"] .btn-label {
  opacity: 0.55;
}

.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 620ms linear infinite;
  flex: none;
}

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

/* ============================ forms ==================================== */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.field label {
  font-size: var(--text-sm);
  font-weight: 500;
}

.field-hint {
  font-size: var(--text-xs);
  color: var(--color-muted);
}

.input {
  font: inherit;
  font-size: var(--text-base);
  padding: 0.55rem 0.7rem;
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-md);
  background: var(--color-paper);
  color: var(--color-ink);
  width: 100%;
  min-width: 0;
  transition: border-color var(--dur-short) var(--ease-out);
}

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

.input:hover:not(:disabled) {
  border-color: var(--color-rule);
}

.input:disabled {
  background: var(--color-paper-2);
  color: var(--color-muted);
  cursor: not-allowed;
}

.input[aria-invalid="true"] {
  border-color: var(--color-critical);
}

.input[data-state="success"] {
  border-color: var(--color-positive);
}

.field-error {
  font-size: var(--text-sm);
  color: var(--color-critical);
}

/* ============================ tables =================================== */

.table-wrap {
  /* Wide content scrolls inside its own container, never the body. */
  overflow-x: auto;
  margin-inline: calc(var(--space-lg) * -1);
  padding-inline: var(--space-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

th {
  text-align: left;
  font-weight: 500;
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
  padding: 0 var(--space-sm) var(--space-xs) 0;
  border-bottom: var(--rule-hair) solid var(--color-rule);
  white-space: nowrap;
}

td {
  padding: var(--space-sm) var(--space-sm) var(--space-sm) 0;
  border-bottom: var(--rule-hair) solid var(--color-rule-2);
  vertical-align: baseline;
}

.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ============================ misc ===================================== */

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  font-size: var(--text-xs);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  border: var(--rule-hair) solid var(--color-rule);
  color: var(--color-ink-2);
  white-space: nowrap;
}

.pill[data-tone="positive"] {
  border-color: var(--color-positive);
  color: var(--color-positive);
  background: var(--color-positive-soft);
}

.pill[data-tone="action"] {
  border-color: var(--color-action-edge);
  color: var(--color-action);
  background: var(--color-action-soft);
}

.key {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--color-paper-2);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  overflow-wrap: anywhere;
  user-select: all;
}

.account-number {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  user-select: all;
}

.empty {
  padding: var(--space-xl) 0;
  color: var(--color-muted);
  font-size: var(--text-sm);
}

.skeleton {
  background: var(--color-paper-3);
  border-radius: var(--radius-sm);
  height: 1em;
  animation: pulse 1.4s var(--ease-in-out) infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

/* Auth screens: a narrow single column, no full-viewport centring theatre. */
.auth {
  max-width: 25rem;
  margin: var(--space-2xl) auto;
  padding-inline: var(--space-lg);
}

.amount-choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.chip {
  font: inherit;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-pill);
  border: var(--rule-hair) solid var(--color-rule);
  background: var(--color-paper);
  color: var(--color-ink);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--dur-short) var(--ease-out);
}

.chip:hover {
  border-color: var(--color-accent-edge);
}

.chip[aria-pressed="true"] {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
  color: var(--color-accent-deep);
}

.plan {
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.plan[data-featured="true"] {
  border-color: var(--color-accent);
}

.plan-grid {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
}

.toast {
  position: fixed;
  /* Bounded by both edges rather than a 100vw calc — 100vw includes the
     scrollbar, so the calc overflows by ~15px on desktop. */
  left: var(--space-lg);
  right: var(--space-lg);
  bottom: var(--space-lg);
  margin-left: auto;
  z-index: var(--z-toast);
  width: fit-content;
  max-width: 24rem;
  background: var(--color-ink);
  color: var(--color-paper);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-sheet);
  animation: toast-in var(--dur-mid) var(--ease-out);
}

.toast[data-tone="critical"] {
  background: var(--color-critical);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .spinner {
    animation: spin 1.4s linear infinite !important;
  }

  .toast {
    animation: none;
  }
}

@media (max-width: 32rem) {
  .main {
    padding-inline: var(--space-md);
  }
  .topbar,
  .tabs,
  .footer {
    padding-inline: var(--space-md);
  }
  .table-wrap {
    margin-inline: calc(var(--space-md) * -1);
    padding-inline: var(--space-md);
  }
  .topbar-email {
    display: none;
  }
}
