:root {
    --brand: #002147;
    --brand-light: color-mix(in oklch, var(--brand) 90%, white);
    --background: #f7f7f7;
    --card-bg: #fff;
    --input-bg: #f7f7f7;
    --accent: #287796;
    --subtle: #717171;
    --border-color: hsl(0 1% 85% / 1);
    --body-font: #171717;
    --button-border-radius: 25px;

    --light-grey: #eaeaea;
    --dark-grey: #3b3b3b;
    --grey: #545454;
    --mid-grey: #6d6d6e;
    --mid-dark-grey: #868688;

    --card-padding: 2.5rem;
    --card-box-shadow: 0px 4px 20px 5px rgba(0, 0, 0, 0.03);
    --border-radius: 12px;
    --border-radius-full: calc(infinity * 1px);

    --bs-link-color: #0d66ea;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;

    --text-xs-line-height: calc(1 / 0.75);
    --text-sm-line-height: calc(1.25 / 0.875);
    --text-base-line-height: calc(1.5 / 1);
    --text-lg-line-height: calc(1.75 / 1.125);
    --text-xl-line-height: calc(1.75 / 1.25);
    --font-body: 'DM Sans', sans-serif;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background-color: var(--background);
    color: var(--body-font);
}

.card {
    background-color: var(--card-bg);
    padding: var(--card-padding);
    border-radius: var(--border-radius);
    width: 100%;
    box-shadow: var(--card-box-shadow);
}

.card-title {
    color: var(--body-font);
    margin-bottom: 1rem;
}

.logo {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
}

.logo img {
    display: inline-block;
    max-width: 80vw;
    margin: 0 auto;
    width: 100%;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--brand);
  line-height: 1.4em;
  padding: 0.4em 0;
}

.card h3 {
  padding-top: 0;
}

p {
  color: var(--body-font);
  font-size: 0.95rem;
  line-height: 1.4em;
  margin: 0.64em 0;
}

a {
    color: var(--accent);
    text-decoration: none;
}

.form-floating {
    margin: -15px;
}

.form-floating input {
    background-color: var(--input-bg);
    color: white;
    border: 1px solid var(--border-color);
}

.form-floating label {
    color: var(--subtle);
}

.form-check-label {
    color: var(--mid-grey);
}

.card-body {
    display: flex;
    flex-direction: column;
    /*gap: 1rem;*/
}

.card-footer {
    margin-left: -15px;
    margin-right: -15px;
}

button.btn,
input[type="submit"].btn {
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    border-radius: var(--button-border-radius);
    text-align: center;
}

/* Primary */
button.btn-primary,
a.btn-primary,
input[type="submit"].btn-primary {
    background-color: var(--brand);
    color: var(--background);
    border: 1px solid var(--brand);
}

button.btn-primary:hover,
a.btn-primary:hover,
input[type="submit"].btn-primary:hover {
    background-color: var(--brand-light);
    color: var(--background);
    border: 1px solid var(--brand-light);
}

/* Outline */
button.btn-outline-primary,
a.btn-outline-primary,
input[type="submit"].btn-outline-primary {
    background-color: transparent;
    border: 1px solid var(--brand);
    color: var(--brand);
}

button.btn-outline-primary:hover,
a.btn-outline-primary:hover,
input[type="submit"].btn-outline-primary:hover {
    background-color: var(--brand-light);
    color: var(--background);
    border: 1px solid var(--brand-light);
}

input.form-control {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--dark-grey);
    padding: 0.75rem;
    font-size: 1rem;
}

input.form-control::placeholder {
    color: var(--subtle);
}

.social-login-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* One shared provider button. risr/advance and risr/apply sit alongside Google
   and Apple as ordinary providers: same shape, same neutral surface, logo doing
   the identifying. Anything else makes two of the four shout. */
.google-btn,
.apple-btn,
.advance-btn,
.apply-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--button-border-radius);
    background-color: #ffffff;
    color: #1a1a1a;
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.google-btn:hover,
.advance-btn:hover,
.apply-btn:hover {
    background-color: #f5f5f5;
    border-color: #b3b3b3;
}

/* Logos are square app tiles, so they need a fixed box and their own rounding
   to sit level with the label instead of stretching to the button height. */
.google-btn img,
.apple-btn img,
.advance-btn img,
.apply-btn img {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    object-fit: contain;
}

.apple-btn {
    background-color: #000000;
    color: #ffffff;
    border-color: #000000;
}

.apple-btn:hover {
    background-color: #1a1a1a;
    border-color: #1a1a1a;
}

/* In the connections list the actions sit in a row next to the provider
   details, so the buttons size to their label instead of filling the column. */
.connection-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.connection-actions .advance-btn,
.connection-actions .apply-btn {
    width: auto;
    min-height: 0;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.connection-actions .advance-btn img,
.connection-actions .apply-btn img {
    width: 16px;
    height: 16px;
}

hr {
    margin: 5px;
    padding: 0;
}

.form-text {
    color: var(--grey);
}

.controls {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    width: 100%;
}

.controls input[type="submit"] {
    flex: 1;
}

h5 {
    color: var(--body-font);
    margin-bottom: 1rem;
}

.alert:empty {
  background-color: transparent;
  border: 0;
  margin: 0;
  padding: 0;
}

/* Utilities */

.text-xs {
  font-size: var(--text-xs);
  line-height: var(--text-xs--line-height);
}

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

.text-base {
  font-size: var(--text-base);
  line-height: var(--text-base--line-height);
}

.text-lg {
  font-size: var(--text-lg);
  line-height: var(--text-lg--line-height);
}

.text-xl {
  font-size: var(--text-xl);
  line-height: var(--text-xl--line-height);
}

/*
 * UI language switcher, following UXDR-0008
 * (https://styleguide.risr.global/design-decisions/uxdr-0008-standardise-language-switchers/),
 * with the risr/align tokens (vendored @fry-it/align-css). Loaded on every layout:
 * it sits in the manage header and in the entrance pages' header bar.
 */
.language-switcher {
  --ls-border-width-thin: var(--border-width-thin);
  --ls-border-width-thick: var(--border-width-thick);
  --ls-radius-md: var(--radius-md);
  --ls-radius-lg: var(--radius-lg);
  --ls-spacing-xs: var(--spacing-xs);
  --ls-spacing-sm: var(--spacing-sm);
  --ls-spacing-lg: var(--spacing-lg);
  --ls-surface-background: var(--color-surface-background);
  --ls-surface-foreground: var(--color-surface-foreground);
  --ls-surface-border: var(--color-surface-border);
  --ls-subtle-background: var(--color-surface-subtle-background);
  --ls-selected-border: var(--brand);
  --ls-ghost-foreground: var(--color-action-ghost-foreground);
  --ls-ghost-hover-foreground: var(--color-action-ghost-hover-foreground);
  --ls-elevation-overlay: var(--elevation-overlay);

  align-items: center;
  display: inline-flex;
  position: relative;
  /* The header spaces its children apart; sit with the other header controls. */
  margin-left: auto;
}

.language-switcher + .app-launcher {
  margin-left: 0;
}

/* Trigger: globe + region (line 1) + uppercase language code (line 2). It
   wraps at narrow widths and high zoom; it never collapses to icon-only. */
.language-switcher__trigger {
  align-items: center;
  appearance: none;
  background: transparent;
  border: var(--ls-border-width-thin) solid transparent;
  border-radius: var(--ls-radius-md);
  color: var(--ls-ghost-foreground);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  gap: var(--ls-spacing-xs);
  min-height: 2.5rem;
  padding: 0 var(--ls-spacing-sm);
}

.language-switcher__trigger:hover,
.language-switcher__trigger[aria-expanded="true"] {
  color: var(--ls-ghost-hover-foreground);
}

.language-switcher__trigger:focus-visible {
  outline: var(--ls-border-width-thick) solid currentColor;
  outline-offset: var(--ls-border-width-thick);
}

.language-switcher .language-switcher__globe {
  flex: none;
  height: 1.25rem;
  width: 1.25rem;
}

.language-switcher__current {
  display: inline-flex;
  flex-direction: column;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
}

.language-switcher__code {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Panel: an overlay anchored to the trigger; global.js picks the side. */
#language-dropdown {
  background: var(--ls-surface-background);
  border: var(--ls-border-width-thin) solid var(--ls-surface-border);
  border-radius: var(--ls-radius-lg);
  box-shadow: var(--ls-elevation-overlay);
  box-sizing: border-box;
  color: var(--ls-surface-foreground);
  margin-top: var(--ls-spacing-sm);
  max-width: calc(100vw - 2 * var(--ls-spacing-lg));
  min-width: 0;
  padding: var(--ls-spacing-sm);
  position: absolute;
  top: 100%;
  width: max-content;
  z-index: 100;
}

#language-dropdown ul {
  display: flex;
  flex-direction: column;
  gap: var(--ls-spacing-xs);
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Every option reserves the selected border, so selecting never shifts it. */
.language-switcher__option {
  align-items: center;
  appearance: none;
  background: transparent;
  border: var(--ls-border-width-thick) solid transparent;
  border-radius: var(--ls-radius-md);
  box-sizing: border-box;
  color: inherit;
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 0.875rem;
  gap: var(--ls-spacing-sm);
  padding: var(--ls-spacing-sm) var(--ls-spacing-lg) var(--ls-spacing-sm) var(--ls-spacing-sm);
  text-align: left;
  width: 100%;
}

.language-switcher__option:hover {
  background: var(--ls-subtle-background);
}

/* Selection: border + checkmark. */
.language-switcher__option[aria-current="true"] {
  border-color: var(--ls-selected-border);
  font-weight: 600;
}

.language-switcher .language-switcher__check {
  flex: none;
  height: 1rem;
  visibility: hidden;
  width: 1rem;
}

.language-switcher__option[aria-current="true"] .language-switcher__check {
  visibility: visible;
}

/* Focus: a ring outside the border, distinct from the selection. */
.language-switcher__option:focus-visible {
  outline: var(--ls-border-width-thick) solid var(--accent);
  outline-offset: var(--ls-border-width-thick);
}

/* Entrance pages: the switcher sits in a slim header bar above the card. */
.entrance-header {
  display: flex;
  justify-content: flex-end;
  left: 0;
  padding: 0.64em;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 99;
}
