/*
 * HPMA Identity. Colours and type follow Platform's shared tokens
 * (packages/ui/src/styles/tokens.css). Buttons and links use a darker coral than
 * the brand's #F15B5D so white and body text on them meet WCAG AA contrast.
 * No inline styles anywhere: the CSP (HI-15) forbids them.
 */
:root {
  --hpma-color-brand: #F15B5D;
  --hpma-color-action: #C8383B;
  --hpma-color-action-hover: #A92E31;
  --hpma-color-accent-light: #FCDEDF;
  --hpma-color-text: #171717;
  --hpma-color-text-secondary: #5C5C5C;
  --hpma-color-bg: #FFFFFF;
  --hpma-color-surface-lowered: #EEEFEF;
  --hpma-color-border: #D1D1D1;
  --hpma-color-success: #16A34A;
  --hpma-color-danger: #DC2626;
  --hpma-font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --hpma-radius-md: 8px;
  --hpma-radius-lg: 12px;
  --hpma-space-card-padding: 24px;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--hpma-color-surface-lowered);
  color: var(--hpma-color-text);
  font-family: var(--hpma-font-family);
  font-size: 1rem;
  line-height: 1.5;
}

a {
  color: var(--hpma-color-action);
}

a:hover {
  color: var(--hpma-color-action-hover);
}

.site-header {
  display: flex;
  justify-content: center;
  padding: 32px 16px 16px;
}

.site-header__logo {
  display: block;
  width: 124px;
  height: auto;
}

.page {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 16px 32px;
}

.card {
  width: 100%;
  max-width: 420px;
  align-self: flex-start;
  padding: var(--hpma-space-card-padding);
  background: var(--hpma-color-bg);
  border: 1px solid var(--hpma-color-border);
  border-top: 4px solid var(--hpma-color-brand);
  border-radius: var(--hpma-radius-lg);
}

.card__title {
  margin: 0 0 8px;
  font-size: 1.5rem;
  line-height: 1.25;
}

.card__lede {
  margin: 0 0 24px;
  color: var(--hpma-color-text-secondary);
}

.card__note {
  margin: -8px 0 24px;
  font-size: 0.875rem;
  color: var(--hpma-color-text-secondary);
}

.card__links {
  margin: 24px 0 0;
  text-align: center;
  font-size: 0.875rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-size: 0.875rem;
  font-weight: 600;
}

/* 16px text keeps iOS Safari from zooming into the field. */
.field__input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--hpma-color-border);
  border-radius: var(--hpma-radius-md);
  background: var(--hpma-color-bg);
  color: var(--hpma-color-text);
  font: inherit;
  font-size: 1rem;
}

.field__input:focus {
  outline: 2px solid var(--hpma-color-action);
  outline-offset: 1px;
  border-color: var(--hpma-color-action);
}

.field--checkbox {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.field--checkbox .field__label {
  font-weight: 400;
}

.field__checkbox {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--hpma-color-action);
}

.button {
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: var(--hpma-radius-md);
  background: var(--hpma-color-action);
  color: #FFFFFF;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.button:hover {
  background: var(--hpma-color-action-hover);
}

.button:focus-visible {
  outline: 2px solid var(--hpma-color-text);
  outline-offset: 2px;
}

.button--secondary {
  background: var(--hpma-color-bg);
  color: var(--hpma-color-text);
  border: 1px solid var(--hpma-color-border);
}

.button--secondary:hover {
  background: var(--hpma-color-surface-lowered);
}

.flash {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--hpma-radius-md);
  font-size: 0.875rem;
}

.flash--alert {
  background: #FDECEC;
  color: #8F1D1D;
  border: 1px solid #F5C2C2;
}

.flash--notice {
  background: #E9F7EF;
  color: #14532D;
  border: 1px solid #BBE5CB;
}

.flash__list {
  margin: 0;
  padding-left: 18px;
}

.site-footer {
  padding: 16px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--hpma-color-text-secondary);
}

.card__subhead {
  margin: 0 0 8px;
  font-weight: 600;
}

.card__list {
  margin: 0 0 24px;
  padding-left: 20px;
}

.card__detail {
  margin: 0;
  font-size: 0.875rem;
  color: var(--hpma-color-text-secondary);
}

.field__input--code {
  font-size: 1.5rem;
  letter-spacing: 0.3em;
  text-align: center;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--hpma-color-action);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.link-button:hover {
  color: var(--hpma-color-action-hover);
}

.field__hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--hpma-color-text-secondary);
}

.button--link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

a.button--secondary:hover {
  color: var(--hpma-color-text);
}

/* Support screens (HI-59): a wider card with tables. */
.site-header--support {
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.site-header__home {
  display: block;
}

.site-header__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  font-size: 0.875rem;
}

.site-header__context {
  color: var(--hpma-color-text-secondary);
}

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

.section-title {
  margin: 32px 0 12px;
  font-size: 1.125rem;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.badge {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.badge--success {
  background: #E9F7EF;
  color: #14532D;
}

.badge--danger {
  background: #FDECEC;
  color: #8F1D1D;
}

.badge--muted {
  background: var(--hpma-color-surface-lowered);
  color: var(--hpma-color-text-secondary);
}

.details {
  display: grid;
  grid-template-columns: minmax(120px, max-content) 1fr;
  gap: 6px 16px;
  margin: 0;
  font-size: 0.9375rem;
}

.details dt {
  color: var(--hpma-color-text-secondary);
}

.details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 16px;
}

.form--inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.field--grow {
  flex: 1 1 240px;
}

.button--auto {
  width: auto;
}

.button--danger {
  background: var(--hpma-color-danger);
}

.button--danger:hover {
  background: #B91C1C;
}

.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th,
.table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--hpma-color-border);
  text-align: left;
  vertical-align: top;
}

.table th {
  font-weight: 600;
  white-space: nowrap;
}

.table__nowrap {
  white-space: nowrap;
}

.section-note {
  margin-bottom: 12px;
}
