/* Application layout and TVM Nova components, on the Nova tokens (static/nova/colors_and_type.css).
   Components follow the Nova specification and the Klantportaal UI kit; the Jinja macros that
   render them are in platform/presentation/templates/components/nova.html.
   Mobile first: phone styles by default, wider screens from 600px. */

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

body {
  margin: 0;
  font-family: var(--tvm-font);
  line-height: 148%;
  color: var(--fg-1);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
}

/* ---------------------------------------------------------------- app frame */

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

.shell--auth {
  background: var(--bg-muted-green);
}

.topbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 56px;
  padding: 0 var(--sp-4);
  background: var(--white);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar__home {
  display: block;
}

.topbar__logo {
  display: block;
  height: 24px;
}

.topbar__divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
}

.topbar__product {
  font-size: 16px;
  font-weight: 500;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-left: auto;
  text-align: right;
  line-height: 148%;
}

.topbar__who {
  display: none;
}

.topbar__name {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.topbar__org {
  display: block;
  font-size: 12px;
  color: var(--fg-2);
}

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue-tonal);
  color: var(--blue-1000);
  font-size: 14px;
  font-weight: 700;
}

.page {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-4);
}

.auth {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--sp-5) var(--sp-4);
}

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-6);
  padding: var(--sp-3) var(--sp-4);
  background: var(--white);
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--fg-2);
}

.footer a {
  color: var(--fg-2);
  font-weight: 400;
}

/* ---------------------------------------------------------------- card */

/* One card for every onboarding step: the UI kit's auth card (white, green outline). */
.card {
  width: 100%;
  max-width: 480px;
  padding: var(--sp-6) var(--sp-5);
  background: var(--bg-card);
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-lg);
}

.card--wide {
  max-width: 640px;
}

.card--center {
  text-align: center;
}

.card__title {
  margin: 0 0 var(--sp-2);
  font-size: 20px;
  line-height: 134%;
  font-weight: 700;
}

.card__sub {
  margin: 0 0 var(--sp-4);
  font-size: 16px;
  line-height: 148%;
  color: var(--fg-2);
}

.card__sub strong {
  color: var(--fg-1);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.card__text {
  margin: 0 0 var(--sp-4);
  font-size: 14px;
  line-height: 148%;
  color: var(--fg-2);
}

.card__back {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  margin: 0 0 var(--sp-2);
  font-size: 14px;
}

/* Step indicator: the UI kit's progress layout ("1 van 2 acties"). */
.steps {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-4);
}

.steps__text {
  font-size: 14px;
  color: var(--fg-2);
}

.steps__track {
  flex-basis: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--neutral-200);
  overflow: hidden;
}

.steps__fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--green-fill);
}

.steps__fill--1 { width: 25%; }
.steps__fill--2 { width: 50%; }
.steps__fill--3 { width: 75%; }
.steps__fill--4 { width: 100%; }

/* Status mark: an icon in a tonal circle. */
.mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 0 var(--sp-4);
  border-radius: 50%;
}

.card--center .mark {
  margin-left: auto;
  margin-right: auto;
}

.mark .icon {
  width: 28px;
  height: 28px;
}

.mark--green { background: var(--green-tonal); color: var(--green-1000); }
.mark--blue { background: var(--blue-tonal); color: var(--blue-1000); }
.mark--orange { background: var(--orange-tonal); color: var(--orange-1000); }

/* ---------------------------------------------------------------- form fields */

/* Nova input: filled, label inside the box, bottom line on focus (green) and error (red). */
.field {
  display: block;
  margin: 0 0 var(--sp-3);
}

.field__box {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: var(--bg-input);
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  transition: border-color .15s ease;
}

.field__box:focus-within {
  border-bottom-color: var(--green-fill);
}

.field__label {
  display: block;
  font-size: 12px;
  line-height: 148%;
  color: var(--fg-2);
}

.field__box:focus-within .field__label {
  color: var(--green-1000);
}

.field__col {
  flex: 1;
  min-width: 0;
}

.field__input {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--tvm-font);
  font-size: 16px;
  color: var(--fg-1);
}

.field__help {
  display: block;
  padding: var(--sp-1) 0 0;
  font-size: 12px;
  line-height: 148%;
  color: var(--fg-3);
}

.field--error .field__box {
  border-bottom-color: var(--red-1000);
}

.field--error .field__label,
.field--error .field__help {
  color: var(--red-1000);
}

.field__error-icon {
  color: var(--red-1000);
}

/* One-time code: six Nova input boxes (WF S4). */
.code {
  margin: 0 0 var(--sp-4);
  padding: 0;
  border: 0;
}

.code__legend {
  margin: 0 0 var(--sp-2);
  padding: 0;
  font-size: 14px;
  color: var(--fg-2);
}

.code__boxes {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 52px));
  gap: var(--sp-2);
}

.code__box {
  width: 100%;
  height: 56px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  outline: none;
  background: var(--bg-input);
  font-family: var(--tvm-font);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--fg-1);
}

.code__box:focus {
  border-bottom-color: var(--green-fill);
}

.code--error .code__box {
  border-bottom-color: var(--red-1000);
}

.code__help {
  display: block;
  padding: var(--sp-1) 0 0;
  font-size: 12px;
  line-height: 148%;
  color: var(--fg-3);
}

.code--error .code__help {
  color: var(--red-1000);
}

/* Checkbox (S6). */
.check {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  margin: var(--sp-5) 0 0;
  font-size: 16px;
  line-height: 148%;
  cursor: pointer;
}

.check__input {
  width: 24px;
  height: 24px;
  flex: none;
  margin: 2px 0 0;
  accent-color: var(--green-fill);
}

.check__note {
  display: block;
  margin: var(--sp-2) 0 0 calc(24px + var(--sp-3));
  font-size: 12px;
  color: var(--fg-2);
}

.check__error {
  display: block;
  margin: var(--sp-2) 0 0 calc(24px + var(--sp-3));
  font-size: 12px;
  color: var(--red-1000);
}

/* ---------------------------------------------------------------- buttons and links */

/* Nova solid and soft buttons (UI kit Primitives). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 48px;
  padding: var(--sp-3) var(--sp-5);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--tvm-font);
  font-size: 14px;
  font-weight: 500;
  line-height: 148%;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.btn:hover {
  text-decoration: none;
}

/* Keyboard focus: the orange ring (DS) on buttons, links and the checkbox. Inputs show focus with
   their green bottom line only, as the DS input spec does. */
.btn:focus-visible,
.check__input:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--orange-focus);
  outline-offset: 2px;
}

.btn--full { width: 100%; }
.btn--primary { background: var(--green-fill); color: var(--fg-on-fill); }
.btn--primary:hover { background: var(--green-fill-hover); }
.btn--primary:active { background: var(--green-fill-press); }
.btn--tonal { background: var(--green-tonal); color: var(--green-1000); }
.btn--tonal:hover { background: var(--green-tonal-hover); }
.btn--ghost { background: var(--white); color: var(--grey-1100); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--neutral-100); }
.btn:disabled,
.btn[aria-disabled="true"] {
  background: var(--neutral-200);
  color: var(--neutral-500);
  border-color: transparent;
  cursor: not-allowed;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin: var(--sp-4) 0 0;
}

.link-row {
  margin: var(--sp-3) 0 0;
  font-size: 14px;
  color: var(--fg-2);
  text-align: center;
}

.link-row a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-row--start {
  text-align: left;
}

/* Resend with its wait (S2). The button is a form submit styled as a link. */
.resend {
  margin: var(--sp-4) 0 0;
  font-size: 14px;
  color: var(--fg-2);
  text-align: center;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--tvm-font);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-link);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.link-button:disabled {
  color: var(--fg-3);
  text-decoration: none;
  cursor: default;
}

/* ---------------------------------------------------------------- feedback */

/* Alert: one component, four tones; an icon and text, never colour alone. */
.alert {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  margin: 0 0 var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-left: 4px solid;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 148%;
  text-align: left;
}

.alert .icon {
  margin-top: 1px;
}

.alert__title {
  display: block;
  font-weight: 700;
}

.alert--info { background: var(--blue-tonal); border-color: var(--blue-1000); color: var(--blue-1100); }
.alert--success { background: var(--green-tonal); border-color: var(--green-fill); color: var(--green-1100); }
.alert--warning { background: var(--orange-tonal); border-color: var(--orange-1000); color: var(--orange-1100); }
.alert--error { background: var(--red-tonal); border-color: var(--red-1000); color: var(--red-1100); }

.loading {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  margin: 0 0 var(--sp-4);
  font-size: 14px;
  color: var(--fg-2);
}

.spinner {
  width: 20px;
  height: 20px;
  flex: none;
  border: 2px solid var(--green-tonal);
  border-top-color: var(--green-fill);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}

.skeleton {
  height: 12px;
  margin: var(--sp-3) 0;
  border-radius: var(--radius-xs);
  background: var(--neutral-150);
}

.skeleton--short {
  width: 55%;
}

/* ---------------------------------------------------------------- content blocks */

/* The legal-entity statement (S5). */
.statement {
  margin: 0 0 var(--sp-3);
  font-size: 14px;
  font-weight: 700;
  line-height: 148%;
}

/* Label/value list (S5): one column of rows, label left and value right, as in WF S5. */
.details {
  margin: 0 0 var(--sp-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.details__row {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: var(--sp-3);
  align-items: baseline;
  padding: var(--sp-1) var(--sp-4);
  border-top: 1px solid var(--border-subtle);
}

.details__row:first-child {
  border-top: 0;
}

.details dt {
  font-size: 14px;
  color: var(--fg-2);
}

.details dd {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* Provenance: where a value comes from and when it was retrieved. */
.source {
  display: flex;
  gap: var(--sp-2);
  align-items: flex-start;
  margin: 0;
  font-size: 12px;
  line-height: 148%;
  color: var(--fg-2);
}

.source .icon {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--green-1000);
}

/* Terms documents (S6): native disclosure, so the page scrolls as a whole. */
.document {
  margin: 0 0 var(--sp-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.document__summary {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 52px;
  padding: var(--sp-3) var(--sp-4);
  list-style: none;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

.document__summary::-webkit-details-marker {
  display: none;
}

.document__summary .icon {
  color: var(--green-1000);
}

.document__summary > .icon:last-child {
  margin-left: auto;
}

.document__version {
  display: none;
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  color: var(--fg-2);
}

.document__body {
  padding: 0 var(--sp-4) var(--sp-4);
  font-size: 14px;
  line-height: 148%;
  color: var(--fg-2);
}

.document__body p {
  margin: 0 0 var(--sp-2);
  font-size: 14px;
}

.document__body h3 {
  margin: var(--sp-3) 0 var(--sp-1);
  font-size: 14px;
  font-weight: 700;
  color: var(--fg-1);
}

/* Numbered "what happens next" list (landing). */
.intro {
  display: grid;
  gap: var(--sp-3);
  margin: 0 0 var(--sp-5);
  padding: 0;
  list-style: none;
  counter-reset: intro;
}

.intro li {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  font-size: 14px;
  line-height: 148%;
}

.intro li::before {
  counter-increment: intro;
  content: counter(intro);
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  background: var(--green-tonal);
  color: var(--green-1000);
  font-size: 12px;
  font-weight: 700;
}

.intro__heading {
  margin: 0 0 var(--sp-3);
  font-size: 14px;
  font-weight: 700;
  color: var(--fg-2);
}

/* The one-time code, shown (S4 opened on another device). */
.code-display {
  margin: 0 0 var(--sp-4);
  padding: var(--sp-4);
  border-radius: var(--radius-md);
  background: var(--green-tonal);
  color: var(--green-1100);
  font-size: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* ---------------------------------------------------------------- placeholders */

.placeholder {
  padding: var(--sp-8);
  border: 2px dashed var(--neutral-400);
  border-radius: var(--radius-lg);
  background: var(--white);
  color: var(--fg-2);
  font-size: 14px;
  text-align: center;
}

/* ---------------------------------------------------------------- wider screens */

@media (min-width: 600px) {
  .topbar {
    min-height: 64px;
    padding: 0 var(--sp-10);
    gap: var(--sp-4);
  }

  .topbar__logo,
  .topbar__divider {
    height: 28px;
  }

  .topbar__who {
    display: block;
  }

  .page {
    padding: var(--sp-12) var(--sp-6);
  }

  .auth {
    padding: var(--sp-5) var(--sp-6);
  }

  .footer {
    padding: var(--sp-4) var(--sp-10);
  }

  .card {
    padding: var(--sp-6) var(--sp-8);
    box-shadow: var(--shadow-sm);
  }

  .actions--row {
    flex-direction: row;
  }

  .actions--row > * {
    flex: 1;
  }

  .card__title {
    font-size: 24px;
    line-height: 132%;
  }

  .details__row {
    grid-template-columns: 148px 1fr;
  }

  .document__version {
    display: inline;
  }

  .document__summary > .icon:last-child {
    margin-left: 0;
  }

  .steps {
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--sp-3);
  }

  .steps__text {
    white-space: nowrap;
  }

  .steps__track {
    flex: 1;
  }
}
