/* Landdyr-innsending — token-bound CSS for the Mattilsynet visual expression.
 *
 * Source of truth: DESIGN.md.  The interface stays restrained: paper-like
 * Gåsunge background, Havdyp green-teal as the single accent, single
 * typeface (Mattilsynet Sans Variable with system fallback), 4 px spacing
 * grid, hairline borders. No invented intermediate values. */

/* Web font — Mattilsynet Sans (variable WOFF2 copied from
 * repos/mattilsynet-design/public/docs/font/variable/) so we don't
 * depend on the Mattilsynet npm distribution. */
@font-face {
  font-family: "Mattilsynet Sans";
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  src: url("/static/fonts/MattilsynetSansVariableVF.woff2") format("woff2");
}

/* Samme variable fil, men med `ital`-aksen slått på, slik at kursiv bruker
 * ekte kursivglyffer i stedet for browser-syntetisert skråstilling. */
@font-face {
  font-family: "Mattilsynet Sans";
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
  font-variation-settings: "ital" 1;
  src: url("/static/fonts/MattilsynetSansVariableVF.woff2") format("woff2");
}

:root {
  color-scheme: light;

  /* === Color: primary (Havdyp / Granskog family) === */
  --color-bg:                 #FAF7F4; /* Gåsunge — page surface */
  --color-bg-tinted:          rgba(61 92 61 / 0.06);
  --color-surface:            #FFFFFF; /* Hvit */
  --color-surface-tinted:     #E6EFE1;
  --color-surface-hover:      #E2F1DF; /* Lav */
  --color-surface-active:     #D8EED8;
  --color-border-subtle:      rgba(107 107 107 / 0.15);
  --color-border-default:     #054449; /* Granskog */
  --color-border-strong:      #032C30;
  --color-logo:               #054449; /* Same as favicon.svg light fill */
  --color-text:               #054449; /* Granskog */
  --color-text-strong:        #032C30;
  --color-text-subtle:        #116E6B; /* Havdyp */
  --color-text-muted:         #6B6B6B; /* Field Border Gray as supporting text */
  --color-accent:             #116E6B;

  --color-action:             #116E6B; /* Havdyp */
  --color-action-hover:       #054449; /* Granskog */
  --color-action-active:      #032C30; /* Mørk granskog */
  --color-action-contrast:    #FFFFFF;
  --color-main-base:          #68B096;

  /* === Color: info / success / warning / danger === */
  --color-info-text:          #153F7B;
  --color-info-surface:       #DFEEF6;
  --color-info-border:        rgba(21 63 123 / 0.3);

  --color-success-text:       #054449;
  --color-success-surface:    #E2F1DF;
  --color-success-border:     rgba(5 68 73 / 0.28);

  --color-warning-text:       #572F28;
  --color-warning-surface:    #FEECBE;
  --color-warning-border:     rgba(127 67 59 / 0.3);

  --color-danger-text:        #AA2C1C;
  --color-danger-text-strong: #791111;
  --color-danger-surface:     #FEEAE6;
  --color-danger-border:      #AA2C1C;

  --color-link-visited:       #663299;
  --color-focus-ring:         #3D3D3D; /* Authority Text */

  /* === Typography === */
  --font-family: "Mattilsynet Sans", system-ui, -apple-system,
                 "Segoe UI", Roboto, sans-serif;
  --font-weight-regular: 400;
  --font-weight-medium:  500;
  --font-weight-bold:    700;

  --text-default:   1.125rem;  /* 18 px */
  --text-muted:     1rem;      /* 16 px */
  --text-ingress:   1.5rem;    /* 24 px */
  --heading-2xs:    1.125rem;  /* 18 px */
  --heading-xs:     1.3125rem; /* 21 px */
  --heading-sm:     1.5rem;    /* 24 px */
  --heading-md:     1.875rem;  /* 30 px */
  --heading-lg:     2.25rem;   /* 36 px */
  --line-height-tight: 1.3;
  --line-height-relaxed: 1.5;

  /* === Spacing (4 px grid) === */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-7:  28px;
  --space-8:  32px;
  --space-10: 40px;
  --space-11: 44px;
  --space-12: 48px;
  --space-15: 60px;
  --space-22: 88px;

  --content-width-readable: 48rem;
  --content-width-surface: calc(var(--content-width-readable) + (var(--space-8) * 2));

  /* === Radius / border / shadow === */
  --radius-sm:  2.5px;
  --radius-md:  5px;
  --radius-lg:  10px;
  --radius-xl:  15px;
  --radius-full: 9999px;

  --border-width: 1px;
  --border-width-focus: 3px;

  --shadow-sm: 0 0 1px 0 rgba(0,0,0,.15), 0 1px 2px 0 rgba(0,0,0,.12),
               0 2px 4px 0 rgba(0,0,0,.10);
  --shadow-md: 0 0 1px 0 rgba(0,0,0,.14), 0 2px 4px 0 rgba(0,0,0,.12),
               0 4px 8px 0 rgba(0,0,0,.12);

  --transition-default: 0.2s ease-out;
}

/* ============================================================
 *  Reset & base
 * ============================================================ */

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: var(--text-default);
  line-height: var(--line-height-relaxed);
  font-weight: var(--font-weight-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

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

.app-header {
  background: var(--color-surface);
  border-bottom: var(--border-width) solid var(--color-border-subtle);
  padding: var(--space-4) var(--space-6);
}

.app-header__inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.app-header__logo {
  display: inline-flex;
  align-items: center;
  color: var(--color-logo);
  text-decoration: none;
  border-radius: var(--radius-sm);
  min-height: var(--space-11);
}

.app-header__logo:visited {
  color: var(--color-logo);
}

.app-header__logo:hover {
  text-decoration: none;
}

.app-header__logo:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 4px;
}

.app-header__mark {
  display: inline-flex;
  align-items: center;
  color: inherit;
}

.app-header__symbol {
  display: block;
  width: 2.5rem;
  height: 2.5rem;
  overflow: hidden;
}

.app-header__symbol svg {
  display: block;
  width: auto;
  height: 100%;
  max-width: none;
}

.app-header__subbrand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-left: var(--space-3);
  padding-left: var(--space-3);
  min-height: 2.5rem;
  border-left: max(1px, calc(var(--border-width) / 2)) solid currentColor;
  color: inherit;
  font-size: 1rem;
  line-height: 1.05;
}

.app-header__brand-name {
  font-size: 0.63em;
  font-weight: var(--font-weight-bold);
}

.app-header__subbrand-name {
  font-size: 1em;
  font-weight: var(--font-weight-medium);
  max-width: 9.5rem;
}

.app-header__brand-name,
.app-header__subbrand-name {
  display: block;
}

.app-header__mark > svg {
  display: block;
  height: 2.5rem;
  width: auto;
}

.app-header__user {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-strong);
  font-size: var(--text-muted);
  font-weight: var(--font-weight-medium);
  padding: var(--space-2) var(--space-3);
  border: var(--border-width) solid var(--color-border-subtle);
  border-radius: 999px;
  background: var(--color-surface-tinted);
  white-space: nowrap;
}

.app-header__user-button {
  appearance: none;
  cursor: pointer;
  font-family: inherit;
  anchor-name: --app-header-user-button;
  transition:
    background-color var(--transition-default),
    border-color var(--transition-default),
    box-shadow var(--transition-default);
}

.app-header__user-button::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.125rem) rotate(45deg);
  transition: transform var(--transition-default);
}

.app-header__user-button:hover,
.app-header__user-button:has(+ .app-header__user-menu:popover-open) {
  border-color: var(--color-border-default);
  background: var(--color-surface-hover);
}

.app-header__user-button:has(+ .app-header__user-menu:popover-open)::after {
  transform: translateY(0.125rem) rotate(225deg);
}

.app-header__user-button:focus-visible {
  outline: var(--border-width-focus) solid var(--color-focus-ring);
  outline-offset: 2px;
}

.app-header__user-icon {
  display: inline-flex;
  width: 1.125rem;
  height: 1.125rem;
  color: var(--color-accent);
  flex-shrink: 0;
}

.app-header__user-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.app-header__user-label {
  color: var(--color-text-muted);
  font-weight: var(--font-weight-regular);
}

.app-header__user-menu {
  margin: var(--space-2) 0 0;
  padding: var(--space-2);
  min-width: 12rem;
  color: var(--color-text-strong);
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  list-style: none;
}

.app-header__user-menu:popover-open {
  inset: auto var(--space-6) auto auto;
  top: calc(var(--space-4) + var(--space-11));
}

@supports (top: anchor(bottom)) {
  .app-header__user-menu:popover-open {
    position-anchor: --app-header-user-button;
    inset: auto;
    top: calc(anchor(bottom) + var(--space-2));
    right: anchor(right);
  }
}

.app-header__user-menu li {
  margin: 0;
}

.app-header__menu-item {
  appearance: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-family: inherit;
  width: 100%;
  min-height: var(--space-10);
  padding: var(--space-2) var(--space-3);
  color: var(--color-text-strong);
  font-size: var(--text-muted);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  text-align: left;
  border-radius: var(--radius-md);
}

.app-header__menu-item:visited {
  color: var(--color-text-strong);
}

.app-header__menu-item:hover {
  background: var(--color-surface-hover);
  text-decoration: none;
}

.app-header__menu-item:focus-visible {
  outline: var(--border-width-focus) solid var(--color-focus-ring);
  outline-offset: 2px;
}

.app-header__nav {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-muted);
}

.app-header__nav a {
  color: var(--color-link);
  font-weight: var(--font-weight-medium);
}

@media (max-width: 30rem) {
  .app-header__inner {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--space-3);
  }
  .app-header__mark svg {
    height: 2rem;
  }
  .app-header__subbrand {
    min-height: 2rem;
    max-width: 7.5rem;
    font-size: 0.875rem;
  }
  .app-header__user-label {
    display: none;
  }
  .app-header__user {
    max-width: 100%;
    min-height: var(--space-11);
    overflow-wrap: anywhere;
    white-space: normal;
  }
  .app-header__user-menu:popover-open {
    inset: auto var(--space-4) auto var(--space-4);
    top: calc(var(--space-4) + var(--space-11));
    min-width: 0;
  }
  @supports (top: anchor(bottom)) {
    .app-header__user-menu:popover-open {
      position-anchor: --app-header-user-button;
      inset: auto var(--space-4) auto auto;
      top: calc(anchor(bottom) + var(--space-2));
    }
  }
}

main.page {
  flex: 1;
  width: 100%;
  max-width: 68rem;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-15);
  display: grid;
  align-content: start;
  gap: var(--space-7);
}

main.page > h1 {
  font-size: var(--heading-lg);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: -0.005em;
  margin: 0;
  color: var(--color-text-strong);
}

/* Form pages should get the user to the first field quickly. Keep the
 * intro measured and the working surface left-aligned instead of
 * stretching a single narrow form across the full page width. */
main.page > h1 + .page-header {
  margin-top: var(--space-1);
  max-width: 48rem;
  gap: var(--space-2);
}

main.page > .page-header + form {
  width: min(100%, var(--content-width-surface));
  justify-self: start;
  gap: var(--space-4);
}

main.page > form + .feedback,
main.page > .page-header + .delete-confirmation {
  width: min(100%, var(--content-width-surface));
  justify-self: start;
}

@media (max-width: 36rem) {
  main.page {
    padding: var(--space-4) var(--space-4) var(--space-12);
    gap: var(--space-4);
  }
  main.page > h1 {
    font-size: var(--heading-md);
  }
  main.page > h1 + .page-header {
    margin-top: 0;
  }
  .app-header {
    padding: var(--space-3) var(--space-4);
  }
}

/* ============================================================
 *  Page header (kicker + lead + context chips)
 * ============================================================ */

.page-header {
  display: grid;
  gap: var(--space-3);
}

main.page > h1 + .page-header > p {
  max-width: 44rem;
}

main.page > h1 + .page-header--list > p {
  max-width: 42rem;
}

main.page > h1 + .page-header--list > .field-description {
  font-size: var(--text-muted);
  color: var(--color-text-muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.page-header > small,
.section-kicker {
  font-size: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
  font-weight: var(--font-weight-medium);
}

.page-header > h2 {
  margin: 0;
  font-size: var(--heading-sm);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: -0.005em;
  color: var(--color-text-strong);
}

.page-header > p {
  margin: 0;
  font-size: var(--text-ingress);
  line-height: var(--line-height-relaxed);
  max-width: 65ch;
  color: var(--color-text-strong);
}

.context-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.context-chips > span {
  display: inline-flex;
  align-items: center;
  height: 2rem;
  padding: 0 var(--space-3);
  border-radius: var(--radius-full);
  background: var(--color-surface-tinted);
  color: var(--color-text-subtle);
  font-size: var(--text-muted);
  border: var(--border-width) solid var(--color-border-subtle);
}

.context-chips > span[data-tone="info"] {
  background: var(--color-info-surface);
  color: var(--color-info-text);
  border-color: var(--color-info-border);
}

.information-illustration {
  order: -1;
  justify-self: center;
  width: min(18.75rem, 70vw);
  margin-bottom: calc(var(--space-2) * -1);
}

.information-illustration img {
  display: block;
  width: 100%;
  height: auto;
}

.page-header--information {
  width: min(100%, var(--content-width-readable));
}

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

.panel {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: grid;
  gap: var(--space-5);
}

.panel--accent {
  background: var(--color-surface-tinted);
  border-color: var(--color-border-subtle);
}

.panel > header {
  display: grid;
  gap: var(--space-2);
}

.panel > header > h2 {
  margin: 0;
  font-size: var(--heading-sm);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-text-strong);
}

.panel > header > p {
  margin: 0;
  color: var(--color-text);
  max-width: 60ch;
}

.information-panel,
.hobbyhold-information-panel {
  width: min(100%, var(--content-width-readable));
  justify-self: start;
  gap: var(--space-6);
}

.hobbyhold-information-panel > h2 {
  margin: 0;
  max-width: 22ch;
  color: var(--color-text-strong);
  font-size: var(--heading-sm);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: 0;
}

.hobbyhold-information-panel > p,
.hobbyhold-information-panel__list {
  margin: 0;
  max-width: 62ch;
  color: var(--color-text);
}

.hobbyhold-information-panel__list {
  display: grid;
  gap: var(--space-2);
  padding-left: var(--space-6);
}

.hobbyhold-information-panel > .form-actions {
  margin-top: var(--space-2);
}

.information-panel > p {
  margin: 0;
  max-width: 65ch;
}

.information-panel details {
  border: var(--border-width) solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: clip;
}

.information-panel summary {
  min-height: 3rem;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  color: var(--color-text-strong);
  font-weight: var(--font-weight-medium);
}

.information-panel summary:hover {
  background: var(--color-surface-hover);
}

.information-panel summary:focus-visible {
  outline: var(--border-width-focus) solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.information-panel details > p,
.information-panel details > ul {
  margin-left: var(--space-4);
  margin-right: var(--space-4);
  max-width: 65ch;
}

.information-panel details > ul {
  padding-left: var(--space-6);
}

.information-panel details > p:last-child {
  margin-bottom: var(--space-4);
}

.information-panel__actions {
  justify-content: flex-end;
}

.information-panel__actions--split {
  justify-content: space-between;
}

@media (max-width: 36rem) {
  .information-illustration {
    width: min(11rem, 58vw);
    margin-bottom: 0;
  }

  .page-header--information > p {
    font-size: var(--text-default);
  }

  .information-panel,
  .hobbyhold-information-panel {
    padding: var(--space-5) var(--space-4);
  }

  .hobbyhold-information-panel > h2 {
    max-width: none;
    font-size: var(--heading-xs);
  }

  .hobbyhold-information-panel > p {
    font-size: var(--text-muted);
  }

  .hobbyhold-information-panel > .form-actions {
    justify-content: stretch;
  }

  .hobbyhold-information-panel > .form-actions > .button {
    width: 100%;
  }

  .information-panel__actions,
  .information-panel__actions--split {
    justify-content: stretch;
  }

  .information-panel__actions > button,
  .information-panel__actions > .button {
    width: 100%;
  }
}

.contact-guidance {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(12rem, max-content);
  gap: var(--space-6);
  align-items: center;
  background: var(--color-info-surface);
  border: var(--border-width) solid var(--color-info-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
}

.contact-guidance__copy {
  display: grid;
  gap: var(--space-2);
}

.contact-guidance__eyebrow {
  color: var(--color-info-text);
  font-size: var(--text-muted);
  font-weight: var(--font-weight-medium);
}

.contact-guidance h2 {
  margin: 0;
  color: var(--color-text-strong);
  font-size: var(--heading-xs);
  line-height: var(--line-height-tight);
}

.contact-guidance p {
  margin: 0;
  max-width: 60ch;
  color: var(--color-text-strong);
}

.contact-guidance__steps {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-guidance__steps li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-info-text);
  font-size: var(--text-muted);
  white-space: nowrap;
}

.contact-guidance__step-number {
  display: inline-grid;
  place-items: center;
  width: var(--space-7);
  height: var(--space-7);
  border-radius: var(--radius-full);
  border: var(--border-width) solid currentColor;
  font-weight: var(--font-weight-bold);
  line-height: 1;
}

.contact-guidance__steps li[data-current="true"] .contact-guidance__step-number {
  background: var(--color-action);
  border-color: var(--color-action);
  color: var(--color-action-contrast);
}

.contact-form-flow {
  display: grid;
  gap: var(--space-6);
}

.contact-form-flow > .form-actions {
  width: min(100%, var(--content-width-readable));
}

.contact-card {
  box-shadow: none;
}

.contact-card__header {
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: start;
  gap: var(--space-4);
}

.contact-card__title {
  display: grid;
  gap: var(--space-2);
}

.contact-card__title > h2,
.contact-card__title > h3,
.contact-card__title > p {
  margin: 0;
}

/* Card titles are demoted to h3 in some features for a correct heading
 * outline; keep the previous (browser-default h2) size so the tag change
 * stays visually invisible. */
.contact-card__title > h3 {
  font-size: 1.5em;
  font-weight: var(--font-weight-bold);
}

.contact-card__title > p {
  max-width: 42ch;
  color: var(--color-text);
}

.contact-card__status {
  display: inline-flex;
  align-items: center;
  min-height: var(--space-7);
  padding: 0 var(--space-3);
  border-radius: var(--radius-full);
  border: var(--border-width) solid var(--color-border-subtle);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--text-muted);
  font-weight: var(--font-weight-medium);
  transition: background var(--transition-default),
              color var(--transition-default),
              border-color var(--transition-default);
}

.contact-card__status[data-state="started"] {
  background: var(--color-warning-surface);
  border-color: var(--color-warning-border);
  color: var(--color-warning-text);
}

.contact-card__status[data-state="complete"] {
  background: var(--color-surface-hover);
  border-color: var(--color-border-default);
  color: var(--color-text-strong);
}

/* ============================================================
 *  Repeating sub-items (item-row)
 *  Flat rows inside a panel, separated by a single hairline divider.
 *  Never nested cards. See DESIGN.md "Repeating sub-items".
 * ============================================================ */

.item-row {
  display: grid;
  gap: var(--space-5);
}

.item-row + .item-row {
  border-top: var(--border-width) solid var(--color-border-subtle);
  padding-top: var(--space-6);
}

.item-row__header {
  display: grid;
  gap: var(--space-2);
}

.item-row__title > h3 {
  margin: 0;
  font-size: var(--heading-xs);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-text-strong);
}

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

  .contact-guidance__steps {
    display: flex;
    flex-wrap: wrap;
  }
}

@media (max-width: 36rem) {
  .contact-guidance {
    padding: var(--space-5) var(--space-4);
  }

  .contact-card__header {
    grid-template-columns: minmax(0, 1fr);
  }

  .contact-card__status {
    justify-self: start;
  }
}

/* ============================================================
 *  Form fields (ds-field custom element)
 * ============================================================ */

ds-field {
  display: grid;
  gap: var(--space-2);
}

ds-field label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  font-size: var(--text-default);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-strong);
}

ds-field .field-description {
  font-size: var(--text-muted);
  color: var(--color-text-muted);
  margin: 0;
}

ds-field input[type="text"],
ds-field input[type="email"],
ds-field input[type="number"],
ds-field input[type="date"],
ds-field input:not([type]),
ds-field select,
ds-field textarea {
  font: inherit;
  color: var(--color-text-strong);
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border-default);
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
  height: 3rem;
  width: 100%;
  max-width: 28rem;
  transition: border-color var(--transition-default),
              box-shadow var(--transition-default);
}

ds-field textarea {
  min-height: 8rem;
  height: auto;
  padding-block: var(--space-3);
  resize: vertical;
}

ds-field input[readonly] {
  background: var(--color-bg-tinted);
  border-color: var(--color-border-subtle);
  color: var(--color-text-strong);
  cursor: default;
}

ds-field input[readonly]:focus-visible {
  /* readonly fields still focus, but never look invalid or interactive */
  outline-color: var(--color-focus-ring);
}

ds-field select {
  padding-right: var(--space-8);
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5L6 6.5L11 1.5' stroke='%23054449' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
}

ds-field input::placeholder {
  color: color-mix(in oklab, var(--color-text-strong) 45%, transparent);
}

ds-field input:focus-visible,
ds-field select:focus-visible,
ds-field textarea:focus-visible {
  outline: var(--border-width-focus) solid var(--color-focus-ring);
  outline-offset: 1px;
  box-shadow: 0 0 0 1px var(--color-surface);
}

ds-field input[aria-invalid="true"],
ds-field select[aria-invalid="true"],
ds-field textarea[aria-invalid="true"] {
  border-color: var(--color-danger-border);
  background: var(--color-surface);
}

.input-with-suffix {
  display: grid;
  grid-template-columns: minmax(0, 12rem) auto;
  align-items: center;
  gap: var(--space-3);
  width: fit-content;
  max-width: 100%;
}

.input-with-suffix > input[type="text"] {
  max-width: none;
}

.input-suffix {
  color: var(--color-text-muted);
  font-size: var(--text-default);
  line-height: var(--line-height-relaxed);
}

.required-marker {
  display: inline-flex;
  align-items: center;
  height: var(--space-6);
  padding: 0 var(--space-2);
  font-size: 0.8125rem;       /* body-xs, smaller than text-muted per DESIGN.md */
  font-weight: var(--font-weight-regular);
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--color-info-text);
  background: var(--color-info-surface);
  border-radius: var(--radius-sm);
}

ds-field .field-error {
  color: var(--color-danger-text);
  font-size: var(--text-muted);
  font-weight: var(--font-weight-medium);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

ds-field .field-error::before {
  content: "";
  display: inline-block;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  background: var(--color-danger-text);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Zm-.75 3.5h1.5v4.5h-1.5V5Zm.75 7.25a.875.875 0 1 1 0-1.75.875.875 0 0 1 0 1.75Z' fill='black'/></svg>") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Zm-.75 3.5h1.5v4.5h-1.5V5Zm.75 7.25a.875.875 0 1 1 0-1.75.875.875 0 0 1 0 1.75Z' fill='black'/></svg>") no-repeat center / contain;
}

/* ============================================================
 *  Form layout
 * ============================================================ */

form {
  display: grid;
  gap: var(--space-5);
}

/* The form's primary surface. The page background is Gåsunge; lifting
 * the fields onto Hvit gives the same surface treatment as the results
 * figure on the list view, so the two pages feel like one product.
 * The card stays close to its content width so the page does not end up
 * with a large, empty right-hand slab beside a single narrow field column. */
.form-card {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: grid;
  gap: var(--space-5);
}

.capacity-update-context {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: var(--space-4);
  row-gap: var(--space-2);
  margin: 0;
  padding-bottom: var(--space-5);
  border-bottom: var(--border-width) solid var(--color-border-subtle);
  max-width: 42rem;
}

.capacity-update-context dt,
.capacity-update-context dd {
  margin: 0;
  line-height: var(--line-height-relaxed);
}

.capacity-update-context dt {
  color: var(--color-text-muted);
  font-size: var(--text-muted);
}

.capacity-update-context dd {
  color: var(--color-text-strong);
  font-size: var(--text-default);
  font-weight: var(--font-weight-medium);
}

@media (max-width: 36rem) {
  .form-card {
    padding: var(--space-5) var(--space-4);
  }

  .capacity-update-context {
    grid-template-columns: 1fr;
    row-gap: 0;
  }

  .capacity-update-context dd + dt {
    margin-top: var(--space-3);
  }

  .input-with-suffix {
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
  }
}

.form-stack {
  display: grid;
  gap: var(--space-4);
  max-width: var(--content-width-readable);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: 0;
  padding-top: var(--space-4);
  border-top: var(--border-width) solid var(--color-border-subtle);
}

.form-actions--inline {
  padding-top: 0;
  border-top: 0;
}

.form-actions > form {
  display: inline-flex;
  margin: 0;
}

.form-actions__hint {
  flex-basis: 100%;
  max-width: 48ch;
  margin: 0 0 var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--text-muted);
}

.form-actions--danger {
  border-top: 0;
  padding-top: 0;
}

.form-card--sectioned > ds-field + ds-field,
.form-card--sectioned > .field-group + ds-field {
  padding-top: var(--space-5);
  border-top: var(--border-width) solid var(--color-border-subtle);
}

.form-card--sectioned > .field-group {
  padding-top: var(--space-2);
}

.form-card--sectioned > p + ds-field,
.form-card--sectioned > p + .field-group {
  margin-top: var(--space-2);
}

.representation-selection {
  display: grid;
  gap: var(--space-5);
  max-width: var(--content-width-surface);
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.representation-selection > h2,
.representation-selection > p {
  margin: 0;
}

.representation-selection > h2 {
  color: var(--color-text-strong);
  font-size: var(--heading-sm);
  line-height: var(--line-height-tight);
}

.representation-selection__lead {
  max-width: 62ch;
  color: var(--color-text);
}

.representation-selection__note {
  max-width: 62ch;
  color: var(--color-text-muted);
  font-size: var(--text-muted);
}

.representation-selection__form {
  gap: var(--space-4);
}

.representation-search {
  display: grid;
  gap: var(--space-2);
  max-width: var(--content-width-readable);
}

.representation-search__label {
  color: var(--color-text-strong);
}

.representation-search__hint,
.representation-search__count,
.representation-search__empty {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-muted);
}

.representation-search input[type="search"] {
  width: 100%;
  min-height: 3rem;
  padding: var(--space-2) var(--space-3);
  color: var(--color-text);
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border-default);
  border-radius: var(--radius-md);
  font: inherit;
}

.representation-search input[type="search"]::placeholder {
  color: rgba(5 68 73 / 0.55);
}

.representation-search input[type="search"]:focus-visible {
  outline: var(--border-width-focus) solid var(--color-focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 var(--border-width) var(--color-surface);
}

.representation-list {
  display: grid;
  gap: var(--space-3);
}

.representation-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background var(--transition-default),
              border-color var(--transition-default),
              transform var(--transition-default);
}

.representation-option[hidden] {
  display: none;
}

.representation-option:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border-default);
}

.representation-option:active {
  transform: scale(0.99);
}

.representation-option:has(input[type="radio"]:checked) {
  background: var(--color-surface-hover);
  border-color: var(--color-border-default);
}

.representation-option input[type="radio"] {
  appearance: none;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0.1rem 0 0;
  display: grid;
  place-content: center;
  flex: 0 0 auto;
  background: var(--color-surface);
  border: 2px solid var(--color-border-default);
  border-radius: var(--radius-full);
}

.representation-option input[type="radio"]::before {
  content: "";
  width: 0.75rem;
  height: 0.75rem;
  border-radius: var(--radius-full);
  background: var(--color-action);
  transform: scale(0);
  transition: transform var(--transition-default);
}

.representation-option input[type="radio"]:checked::before {
  transform: scale(1);
}

.representation-option input[type="radio"]:focus-visible {
  outline: var(--border-width-focus) solid var(--color-focus-ring);
  outline-offset: 3px;
  box-shadow: 0 0 0 var(--border-width) var(--color-surface);
}

.representation-option input[type="radio"][aria-invalid="true"] {
  border-color: var(--color-danger-border);
}

.representation-option__content {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.representation-option__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.representation-option__name {
  color: var(--color-text-strong);
  font-weight: var(--font-weight-bold);
  overflow-wrap: anywhere;
}

.representation-option__tag {
  min-height: 1.75rem;
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-2);
  color: var(--color-info-text);
  background: var(--color-info-surface);
  border: var(--border-width) solid var(--color-info-border);
  border-radius: var(--radius-md);
  font-size: var(--text-muted);
  line-height: var(--line-height-tight);
}

.representation-option__tag--sub-unit {
  color: #7c2d12;
  background: #ffedd5;
  border-color: #fed7aa;
}

.representation-option__tag--main-unit {
  color: var(--color-info-text);
  background: var(--color-info-surface);
  border-color: var(--color-info-border);
}

.representation-option__tag--person {
  color: var(--color-text-muted);
  background: var(--color-surface-subtle);
  border-color: var(--color-border-muted);
}

.representation-option__meta {
  color: var(--color-text-muted);
  font-size: var(--text-muted);
}

@media (max-width: 36rem) {
  .representation-selection {
    padding: var(--space-5) var(--space-4);
  }

  .representation-option {
    gap: var(--space-3);
    padding: var(--space-4) var(--space-3);
  }

  .representation-selection .form-actions > button,
  .representation-selection .form-actions > .button {
    width: 100%;
  }
}

.production-flow {
  gap: var(--space-6);
}

.production-empty-state {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(6rem, 9rem);
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-5);
  background: var(--color-info-surface);
  border: var(--border-width) solid var(--color-info-border);
  border-radius: var(--radius-md);
}

.production-empty-state__content {
  display: grid;
  gap: var(--space-2);
}

.production-empty-state__illustration {
  justify-self: end;
  width: min(9rem, 100%);
}

.production-empty-state__illustration img {
  display: block;
  width: 100%;
  height: auto;
}

.production-empty-state__content > h2,
.production-entry > header > h2,
.production-summary-list > header > h2 {
  margin: 0;
  color: var(--color-text-strong);
  font-size: var(--heading-sm);
  line-height: var(--line-height-tight);
}

.production-empty-state__content > p,
.production-entry > header > p,
.production-summary-item > header > p {
  margin: 0;
  color: var(--color-text);
}

@media (max-width: 48rem) {
  .production-empty-state {
    grid-template-columns: minmax(0, 1fr);
  }

  .production-empty-state__illustration {
    justify-self: start;
    width: min(8rem, 55vw);
  }
}

.production-entry,
.production-summary-list {
  display: grid;
  gap: var(--space-4);
}

.production-summary-list + .production-entry {
  padding-top: var(--space-5);
  border-top: var(--border-width) solid var(--color-border-subtle);
}

.production-entry--secondary {
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-bg-tinted);
  border: var(--border-width) solid var(--color-border-subtle);
  border-radius: var(--radius-md);
}

.production-entry > header {
  display: grid;
  gap: var(--space-2);
}

.production-entry--secondary > header > h2 {
  font-size: var(--heading-xs);
}

.production-entry--secondary > header > p,
.production-entry--secondary .field-description {
  color: var(--color-text-muted);
}

.production-summary-item {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: var(--border-width) solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.production-summary-item > header {
  display: grid;
  gap: var(--space-1);
}

.production-summary-item > header > h3 {
  margin: 0;
  color: var(--color-text-strong);
  font-size: var(--heading-2xs);
  line-height: var(--line-height-tight);
}

.production-summary-item__status {
  display: inline-flex;
  justify-self: start;
  align-items: center;
  min-height: var(--space-8);
  padding: 0 var(--space-3);
  border-radius: var(--radius-full);
  border: var(--border-width) solid var(--color-warning-border);
  background: var(--color-warning-surface);
  color: var(--color-warning-text);
  font-size: var(--text-muted);
  font-weight: var(--font-weight-medium);
}

.production-summary-item__status[data-state="complete"] {
  border-color: var(--color-success-border);
  background: var(--color-success-surface);
  color: var(--color-success-text);
}

.production-entry__actions,
.production-summary-item__actions {
  border-top: 0;
  padding-top: 0;
}

.schema-choice {
  max-width: var(--content-width-readable);
}

.schema-choice__fieldset {
  gap: var(--space-4);
}

.schema-choice__options {
  display: grid;
  gap: var(--space-3);
}

.schema-choice__option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  align-items: start;
  padding: var(--space-4);
  border: var(--border-width) solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-text-strong);
  cursor: pointer;
  transition: border-color var(--transition-default),
              background-color var(--transition-default),
              transform var(--transition-default);
}

.schema-choice__option:hover {
  border-color: var(--color-border-default);
  background: var(--color-surface-hover);
}

.schema-choice__option:active {
  transform: scale(0.99);
}

.schema-choice__option:has(input[type="radio"]:checked) {
  border-color: var(--color-action);
  background: var(--color-surface-hover);
}

.schema-choice__option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.2rem 0 0;
  border: var(--border-width) solid var(--color-border-default);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  display: inline-grid;
  place-content: center;
}

.schema-choice__option input[type="radio"]::before {
  content: "";
  width: 0.64rem;
  height: 0.64rem;
  border-radius: var(--radius-full);
  transform: scale(0);
  transition: transform var(--transition-default);
  background: var(--color-action);
}

.schema-choice__option input[type="radio"]:checked {
  border-color: var(--color-action);
}

.schema-choice__option input[type="radio"]:checked::before {
  transform: scale(1);
}

.schema-choice__option input[type="radio"]:focus-visible {
  outline: var(--border-width-focus) solid var(--color-focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 1px var(--color-surface);
}

.schema-choice__option input[type="radio"][aria-invalid="true"] {
  border-color: var(--color-danger-border);
}

.schema-choice__copy {
  display: grid;
  gap: var(--space-1);
}

.schema-choice__title {
  color: var(--color-text-strong);
  font-size: var(--heading-2xs);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
}

.schema-choice__description {
  color: var(--color-text-muted);
  font-size: var(--text-muted);
  line-height: var(--line-height-relaxed);
}

@media (max-width: 36rem) {
  .schema-choice__option {
    padding: var(--space-4) var(--space-3);
  }
}

/* Coordinate / map field grouping. The interactive map is a progressive
 * enhancement; noscript falls back to the paired latitude/longitude inputs. */
.field-group {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: var(--space-3);
}

.field-group > legend {
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  font-size: var(--text-default);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-strong);
}

.field-group > .field-description {
  margin: 0;
  font-size: var(--text-muted);
  color: var(--color-text-muted);
  max-width: 60ch;
}

.field-group .field-group__options {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.field-group .field-group__option {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-strong);
  font-size: var(--text-default);
  line-height: var(--line-height-relaxed);
  width: fit-content;
  cursor: pointer;
}

.field-group .field-group__option--confirm {
  align-items: flex-start;
  width: auto;
}

.field-group .field-group__option--confirm input[type="checkbox"] {
  margin-top: 0.15em;
  flex: 0 0 auto;
}

.field-group .field-group__option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
  border: var(--border-width) solid var(--color-border-default);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  display: inline-grid;
  place-content: center;
  transition: border-color var(--transition-default),
              box-shadow var(--transition-default),
              background-color var(--transition-default);
}

.field-group .field-group__option input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
  accent-color: var(--color-action);
  border: var(--border-width) solid var(--color-border-default);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  display: inline-grid;
  place-content: center;
  transition: border-color var(--transition-default),
              box-shadow var(--transition-default),
              background-color var(--transition-default);
}

.field-group .field-group__option input[type="checkbox"]::before {
  content: "";
  width: 0.76rem;
  height: 0.76rem;
  transform: scale(0);
  transition: transform var(--transition-default);
  background: var(--color-action-contrast);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M13.78 3.72a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 8.78a.75.75 0 0 1 1.06-1.06L6 10.44l6.72-6.72a.75.75 0 0 1 1.06 0Z' fill='black'/></svg>") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M13.78 3.72a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 8.78a.75.75 0 0 1 1.06-1.06L6 10.44l6.72-6.72a.75.75 0 0 1 1.06 0Z' fill='black'/></svg>") no-repeat center / contain;
}

.field-group .field-group__option:hover input[type="checkbox"] {
  border-color: var(--color-border-strong);
}

.field-group .field-group__option input[type="checkbox"]:checked {
  background: var(--color-action);
  border-color: var(--color-action);
}

.field-group .field-group__option input[type="checkbox"]:checked::before {
  transform: scale(1);
}

.field-group .field-group__option input[type="checkbox"]:focus-visible {
  outline: var(--border-width-focus) solid var(--color-focus-ring);
  outline-offset: 1px;
  box-shadow: 0 0 0 1px var(--color-surface);
}

.field-group .field-group__option input[type="radio"]::before {
  content: "";
  width: 0.62rem;
  height: 0.62rem;
  border-radius: var(--radius-full);
  transform: scale(0);
  transition: transform var(--transition-default);
  background: var(--color-action);
}

.field-group .field-group__option:hover input[type="radio"] {
  border-color: var(--color-border-strong);
}

.field-group .field-group__option input[type="radio"]:checked {
  border-color: var(--color-action);
}

.field-group .field-group__option input[type="radio"]:checked::before {
  transform: scale(1);
}

.field-group .field-group__option input[type="radio"]:focus-visible {
  outline: var(--border-width-focus) solid var(--color-focus-ring);
  outline-offset: 1px;
  box-shadow: 0 0 0 1px var(--color-surface);
}

.field-group .field-group__option input[type="radio"][aria-invalid="true"] {
  border-color: var(--color-danger-border);
}

.field-group .field-group__option input[type="radio"][disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.field-group .field-group__option input[type="checkbox"][aria-invalid="true"] {
  outline: 1px solid var(--color-danger-border);
}

.field-group .field-error {
  color: var(--color-danger-text);
  font-size: var(--text-muted);
  font-weight: var(--font-weight-medium);
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.field-group .field-error::before {
  content: "";
  display: inline-block;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  background: var(--color-danger-text);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Zm-.75 3.5h1.5v4.5h-1.5V5Zm.75 7.25a.875.875 0 1 1 0-1.75.875.875 0 0 1 0 1.75Z' fill='black'/></svg>") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Zm-.75 3.5h1.5v4.5h-1.5V5Zm.75 7.25a.875.875 0 1 1 0-1.75.875.875 0 0 1 0 1.75Z' fill='black'/></svg>") no-repeat center / contain;
}

.field-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4);
}

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

.field-pair ds-field input {
  max-width: none;
}

.kontaktpersoner-form__add {
  display: grid;
  padding-top: var(--space-5);
  border-top: var(--border-width) solid var(--color-border-subtle);
}

.kontaktpersoner-form__add > .button {
  justify-self: start;
}

@media (max-width: 36rem) {
  .kontaktpersoner-form__add > .button {
    justify-self: stretch;
    width: 100%;
  }
}

.map-field {
  --atlas-marker-background: var(--color-action);
  --atlas-marker-background-outer: var(--color-surface);
  --atlas-marker-border: none;
  --atlas-marker-color: var(--color-main-base);
  --atlas-marker-readonly-background: var(--color-warning-surface);
  --atlas-marker-readonly-color: var(--color-warning-text);
  --atlas-cluster-background: var(--color-info-surface);
  --atlas-cluster-border: var(--color-info-text);
  --atlas-cluster-color: var(--color-info-text);
  --atlas-marker-inset: 3px;
  --atlas-marker-shadow-blur: 4px;
  --atlas-marker-shadow-color: rgba(0 0 0 / 0.5);
  --atlas-marker-shadow-offset: 2px;
  --atlas-marker-size: var(--space-6);
  --atlas-tile-background: #f7fcfc;
  --atlas-tile-filter: grayscale(.8) contrast(.75) brightness(1.15);
  display: grid;
  gap: var(--space-3);
  max-width: var(--content-width-readable);
}

.map-field__canvas {
  position: relative;
  aspect-ratio: 2;
  min-height: 26rem;
  width: 100%;
  border: var(--border-width) solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--atlas-tile-background);
}

.map-field__canvas--loading::before,
.map-field__canvas--unavailable::before {
  content: "Kartet lastes inn. Du kan også oppgi koordinater manuelt.";
  position: absolute;
  z-index: 400;
  inset: var(--space-4) auto auto var(--space-4);
  max-width: min(28rem, calc(100% - var(--space-8)));
  padding: var(--space-2) var(--space-3);
  border: var(--border-width) solid var(--color-info-border);
  border-radius: var(--radius-md);
  background: var(--color-info-surface);
  color: var(--color-info-text);
  font-size: var(--text-muted);
  pointer-events: none;
}

.map-field__canvas--unavailable::before {
  content: "Kartflaten kunne ikke lastes. Oppgi koordinater manuelt, eller prøv på nytt.";
}

.map-field[data-invalid="true"] .map-field__canvas {
  border-color: var(--color-danger-border);
}

.map-field__canvas:focus-visible,
.map-field .leaflet-container:focus-visible {
  outline: var(--border-width-focus) solid var(--color-focus-ring);
  outline-offset: 1px;
  box-shadow: 0 0 0 1px var(--color-surface);
}

.map-field__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.map-field__status {
  margin: 0;
  color: var(--color-text-strong);
  font-size: var(--text-muted);
}

.map-field__fallback {
  display: grid;
  border: var(--border-width) solid var(--color-info-border);
  border-radius: var(--radius-lg);
  background: var(--color-info-surface);
  padding: var(--space-4);
}

.map-field__fallback summary {
  cursor: pointer;
  min-height: var(--space-11);
  padding: var(--space-2) 0;
  font-size: var(--heading-2xs);
  font-weight: var(--font-weight-bold);
  color: var(--color-info-text);
}

.map-field__fallback summary:focus-visible {
  outline: var(--border-width-focus) solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.map-field__fallback-content {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.map-field__fallback .field-description {
  margin: 0;
  color: var(--color-info-text);
  font-size: var(--text-muted);
}

.leaflet-container {
  font-family: var(--font-family);
  color: var(--color-text-strong);
  background: var(--atlas-tile-background);
  border-radius: inherit;
}

.leaflet-kartverket-tiles {
  filter: var(--atlas-tile-filter);
  transition: filter 0.5s ease-out;
}

.leaflet-control-layers,
.leaflet-control-zoom a {
  border-color: var(--color-border-subtle);
  color: var(--color-text-strong);
}

.leaflet-control-attribution {
  border-top-left-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

.leaflet-control-attribution a {
  color: inherit;
}

.leaflet-control-zoom {
  border: var(--border-width) solid var(--color-border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.leaflet-control-zoom a {
  width: var(--space-10);
  height: var(--space-10);
  line-height: var(--space-10);
  background: var(--color-surface);
  border-color: inherit;
  color: var(--color-text-strong);
  transition: background var(--transition-default),
              color var(--transition-default),
              box-shadow var(--transition-default);
}

.leaflet-control-zoom a:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-strong);
}

.leaflet-control-zoom a:active {
  background: var(--color-surface-active);
}

.leaflet-control-zoom a:focus-visible {
  outline: var(--border-width-focus) solid var(--color-focus-ring);
  outline-offset: var(--border-width-focus);
  box-shadow: 0 0 0 1px var(--color-surface);
}

.leaflet-touch .leaflet-control-zoom a {
  width: var(--space-11);
  height: var(--space-11);
  line-height: var(--space-11);
}

.leaflet-control-layers {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  font-size: var(--text-muted);
}

.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
  border: var(--border-width) solid var(--color-border-subtle);
}

.leaflet-grab {
  cursor: pointer;
}

.landdyr-map-marker {
  background: none;
  border: 0;
}

.landdyr-map-marker__pin {
  color: var(--atlas-marker-color);
  background: var(--atlas-marker-background);
  border-radius: var(--radius-full);
  box-sizing: border-box;
  display: grid;
  height: var(--atlas-marker-size);
  place-content: center;
  place-items: center;
  position: relative;
  translate: -50% calc(-100% - var(--atlas-marker-inset));
  width: var(--atlas-marker-size);
}

.landdyr-map-marker__pin::after {
  aspect-ratio: 1;
  background: var(--atlas-marker-background-outer);
  border: var(--atlas-marker-border);
  border-radius: 50% 50% 0 50%;
  box-shadow: var(--atlas-marker-shadow-offset) var(--atlas-marker-shadow-offset) var(--atlas-marker-shadow-blur) var(--atlas-marker-shadow-color);
  color: var(--atlas-marker-background);
  content: "";
  inset: calc(var(--atlas-marker-inset) * -1);
  position: absolute;
  rotate: 45deg;
  z-index: -1;
}

.landdyr-map-marker__pin::before {
  background: currentColor;
  border-radius: var(--radius-full);
  content: "";
  height: var(--space-6);
  width: var(--space-6);
}

.landdyr-map-marker.leaflet-drag-target .landdyr-map-marker__pin,
.leaflet-dragging .landdyr-map-marker__pin {
  cursor: grabbing;
}

.landdyr-map-marker--readonly .landdyr-map-marker__pin {
  color: var(--atlas-marker-readonly-color);
  background: var(--atlas-marker-readonly-background);
  border: var(--border-width) solid var(--atlas-marker-readonly-color);
  cursor: default;
  height: var(--space-5);
  width: var(--space-5);
}

.landdyr-map-marker--readonly .landdyr-map-marker__pin::after {
  background: var(--atlas-marker-readonly-background);
  border: var(--border-width) solid var(--atlas-marker-readonly-color);
}

.landdyr-map-marker--readonly .landdyr-map-marker__pin::before {
  background: var(--atlas-marker-readonly-color);
  height: var(--space-1);
  width: var(--space-1);
}

.landdyr-map-cluster-marker {
  background: none;
  border: 0;
}

.landdyr-map-cluster-marker__count {
  align-items: center;
  background: var(--atlas-cluster-background);
  border: var(--border-width) solid var(--atlas-cluster-border);
  border-radius: var(--radius-full);
  box-shadow: 0 var(--atlas-marker-shadow-offset) var(--atlas-marker-shadow-blur) var(--atlas-marker-shadow-color);
  color: var(--atlas-cluster-color);
  display: flex;
  font-size: 0.875rem;
  font-weight: var(--font-weight-bold);
  height: var(--space-8);
  justify-content: center;
  outline: 2px solid var(--atlas-cluster-background);
  width: var(--space-8);
}

@media (max-width: 36rem) {
  .map-field__canvas {
    min-height: 20rem;
  }
}

/* ============================================================
 *  Buttons (data-variant, data-tone, data-size)
 * ============================================================ */

button,
a.button {
  font: inherit;
  font-weight: var(--font-weight-medium);
  min-height: 3rem;
  min-width: 3rem;
  padding: var(--space-2) var(--space-6);
  border-radius: var(--radius-md);
  border: var(--border-width) solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  text-decoration: none;
  background: var(--color-action);
  color: var(--color-action-contrast);
  transition: background var(--transition-default),
              color var(--transition-default),
              transform var(--transition-default),
              border-color var(--transition-default);
}

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

button:active,
a.button:active {
  background: var(--color-action-active);
  transform: scale(0.975);
}

button:focus-visible,
a.button:focus-visible {
  outline: var(--border-width-focus) solid var(--color-focus-ring);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button[data-variant="secondary"],
a.button[data-variant="secondary"] {
  background: transparent;
  color: var(--color-text-strong);
  border-color: var(--color-border-default);
}

button[data-variant="secondary"]:hover,
a.button[data-variant="secondary"]:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-strong);
}

button[data-variant="tertiary"],
a.button[data-variant="tertiary"] {
  background: transparent;
  color: var(--color-text-strong);
  padding: var(--space-2) var(--space-4);
  min-height: 2.5rem;
}

button[data-variant="tertiary"]:hover,
a.button[data-variant="tertiary"]:hover {
  background: var(--color-surface-hover);
}

button[data-tone="danger"] {
  color: var(--color-danger-text);
}

a.button[data-tone="danger"] {
  color: var(--color-danger-text);
}

button:not([data-variant])[data-tone="danger"] {
  background: var(--color-danger-text);
  color: var(--color-action-contrast);
}

button:not([data-variant])[data-tone="danger"]:hover {
  background: var(--color-danger-text-strong);
  color: var(--color-action-contrast);
}

button[data-variant][data-tone="danger"]:hover,
a.button[data-tone="danger"]:hover {
  background: var(--color-danger-surface);
  color: var(--color-danger-text-strong);
}

button[data-size="sm"],
a.button[data-size="sm"] {
  min-height: var(--space-11);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-muted);
}

/* ============================================================
 *  Links (no class, just element styling per the contract)
 * ============================================================ */

a {
  color: var(--color-text-subtle);
  text-decoration: underline;
  text-decoration-thickness: 0.0625em;
  text-underline-offset: 0.27em;
  transition: text-decoration-thickness var(--transition-default);
}

a:hover {
  text-decoration-thickness: 0.125em;
}

a:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

a:visited {
  color: var(--color-link-visited);
}

a.button:visited {
  color: var(--color-action-contrast);
}

a.button[data-variant="secondary"]:visited,
a.button[data-variant="tertiary"]:visited {
  color: var(--color-text-strong);
}

a.button[data-tone="danger"]:visited {
  color: var(--color-danger-text);
}

a.button:not([data-variant])[data-tone="danger"]:visited {
  color: var(--color-action-contrast);
}

/* ============================================================
 *  Error summary (ds-error-summary class hook is required by the
 *  contract; it wraps the link list at the top of the form on submit)
 * ============================================================ */

.ds-error-summary {
  display: grid;
  gap: var(--space-3);
  background: var(--color-danger-surface);
  border: var(--border-width) solid var(--color-danger-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.ds-error-summary h2 {
  margin: 0;
  font-size: var(--heading-xs);
  color: var(--color-danger-text-strong);
}

.ds-error-summary ul {
  margin: 0;
  padding-left: var(--space-5);
  display: grid;
  gap: var(--space-1);
}

.ds-error-summary a {
  color: var(--color-danger-text);
}

/* ============================================================
 *  Feedback panels (initial / empty / error)
 * ============================================================ */

.feedback {
  display: grid;
  gap: var(--space-3);
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.feedback h2 {
  margin: 0;
  font-size: var(--heading-xs);
  color: var(--color-text-strong);
}

.feedback p {
  margin: 0;
  color: var(--color-text);
  max-width: 60ch;
}

.feedback--error {
  border-color: var(--color-danger-border);
  background: var(--color-danger-surface);
}

.feedback--error h2,
.feedback--error p {
  color: var(--color-danger-text-strong);
}

.feedback--success {
  border-color: var(--color-border-default);
  background: var(--color-surface-hover);
}

.feedback--success h2,
.feedback--success p {
  color: var(--color-text-strong);
}

.feedback--warning {
  border-color: var(--color-warning-border);
  background: var(--color-warning-surface);
}

.feedback--warning h2,
.feedback--warning p {
  color: var(--color-warning-text);
}

.feedback form {
  margin-top: var(--space-2);
}

.feedback > .button {
  justify-self: start;
  margin-top: var(--space-2);
}

.status-pill {
  display: inline-flex;
  width: fit-content;
  margin-top: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border: var(--border-width) solid var(--color-info-border);
  border-radius: var(--radius-full);
  background: var(--color-info-surface);
  color: var(--color-info-text);
  font-size: 0.875rem;
  font-weight: var(--font-weight-medium);
  line-height: 1.3;
}

.status-pill[data-variant="success"] {
  border-color: var(--color-success-border);
  background: var(--color-success-surface);
  color: var(--color-success-text);
}

/* ============================================================
 *  Status error pages
 * ============================================================ */

.status-error {
  width: min(100%, var(--content-width-surface));
  justify-self: start;
  display: grid;
  gap: var(--space-4);
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.status-error__code {
  order: -1;
  width: fit-content;
  margin: 0;
  padding: var(--space-1) var(--space-3);
  color: var(--color-info-text);
  background: var(--color-info-surface);
  border: var(--border-width) solid var(--color-info-border);
  border-radius: var(--radius-full);
  font-size: var(--text-muted);
  font-weight: var(--font-weight-medium);
}

.status-error__message {
  max-width: 62ch;
  margin: 0;
  color: var(--color-text-strong);
  font-size: var(--text-ingress);
  line-height: var(--line-height-relaxed);
}

.status-error__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding-top: var(--space-2);
}

@media (max-width: 36rem) {
  .status-error {
    padding: var(--space-5) var(--space-4);
  }

  .status-error__message {
    font-size: var(--text-default);
  }

  .status-error__actions {
    display: grid;
  }

  .status-error__actions > .button {
    width: 100%;
  }
}

/* ============================================================
 *  Session warning toast
 * ============================================================ */

.session-toast {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
  z-index: 20;
  width: min(100% - (var(--space-6) * 2), 32rem);
  display: grid;
  gap: var(--space-4);
  background: var(--color-warning-surface);
  border: var(--border-width) solid var(--color-warning-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  color: var(--color-warning-text);
  padding: var(--space-5);
  padding-right: var(--space-12);
}

.session-toast[hidden] {
  display: none;
}

.session-toast__content {
  display: grid;
  gap: var(--space-1);
}

.session-toast__close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  min-height: var(--space-10);
  min-width: var(--space-10);
  padding: 0;
  background: transparent;
  border-color: transparent;
  color: var(--color-warning-text);
  font-size: var(--heading-xs);
  line-height: 1;
}

.session-toast__close:hover {
  background: rgba(127 67 59 / 0.12);
  color: var(--color-warning-text);
}

.session-toast__close:active {
  background: rgba(127 67 59 / 0.18);
}

.session-toast__eyebrow {
  color: var(--color-warning-text);
  font-size: var(--text-muted);
  font-weight: var(--font-weight-medium);
}

.session-toast__title {
  color: var(--color-warning-text);
  font-size: var(--heading-xs);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
}

.session-toast__message {
  color: var(--color-warning-text);
  font-size: var(--text-muted);
}

.session-toast__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.session-toast__continue {
  color: var(--color-action-contrast);
}

@media (max-width: 36rem) {
  .session-toast {
    right: var(--space-4);
    bottom: var(--space-4);
    width: calc(100% - (var(--space-4) * 2));
  }
}

.empty-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: end;
  gap: var(--space-6);
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.empty-list__content {
  display: grid;
  gap: var(--space-3);
}

.empty-list h2 {
  margin: 0;
  font-size: var(--heading-sm);
  line-height: var(--line-height-tight);
  color: var(--color-text-strong);
}

.empty-list p {
  margin: 0;
  max-width: 46ch;
  color: var(--color-text);
}

.empty-list form {
  justify-self: end;
}

.empty-list--illustrated {
  /* Align the illustrated empty state with the step indicator and the rest
   * of the flow instead of stretching across the full page width. */
  width: min(100%, var(--content-width-readable));
  grid-template-columns: minmax(0, 1fr) minmax(8rem, 12rem);
  grid-template-areas:
    "content illustration"
    "action illustration";
  align-items: center;
}

.empty-list--illustrated .empty-list__content {
  grid-area: content;
}

.empty-list__illustration {
  grid-area: illustration;
  justify-self: end;
  align-self: center;
  width: min(12rem, 100%);
}

.empty-list__illustration img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

.empty-list--illustrated form {
  grid-area: action;
  justify-self: start;
  margin-top: var(--space-2);
}

@media (max-width: 48rem) {
  .empty-list {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }
  .empty-list form,
  .empty-list button {
    justify-self: stretch;
    width: 100%;
  }

  .empty-list--illustrated {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "content"
      "illustration"
      "action";
  }

  .empty-list__illustration {
    justify-self: start;
    width: min(11rem, 70%);
  }
}

@media (max-width: 36rem) {
  .empty-list--illustrated {
    padding: var(--space-5);
  }
}

/* ============================================================
 *  Results table (figure + table[data-mobile="stacked"])
 * ============================================================ */

.results--list {
  display: grid;
  gap: var(--space-4);
}

.results-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.results-header > div {
  display: grid;
  gap: var(--space-2);
}

.results-header h2 {
  margin: 0;
  font-size: var(--heading-sm);
  line-height: var(--line-height-tight);
  color: var(--color-text-strong);
}

.results-header p {
  margin: 0;
  color: var(--color-text-muted);
}

.results-header__note {
  max-width: 52ch;
  text-wrap: pretty;
}

.results-group {
  display: grid;
  gap: var(--space-3);
}

.results-group + .results-group {
  margin-top: var(--space-4);
  padding-top: var(--space-5);
  border-top: var(--border-width) solid var(--color-border-subtle);
}

.results-group__header {
  display: grid;
  gap: var(--space-1);
  max-width: 72ch;
}

.results-group__header h3 {
  margin: 0;
  font-size: var(--heading-2xs);
  line-height: var(--line-height-tight);
  color: var(--color-text-strong);
}

.results-group__header p {
  margin: 0;
  color: var(--color-text-muted);
}

figure {
  margin: 0;
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

thead {
  background: var(--color-bg-tinted);
}

th,
td {
  padding: var(--space-4) var(--space-5);
  text-align: left;
  border-bottom: var(--border-width) solid var(--color-border-subtle);
  vertical-align: middle;
}

th {
  font-weight: var(--font-weight-bold);
  font-size: var(--text-muted);
  color: var(--color-text-subtle);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--color-surface-hover);
}

th:nth-child(1) {
  width: 30%;
}

th:nth-child(2) {
  width: 23%;
}

th:nth-child(3) {
  width: 15%;
}

th:nth-child(4) {
  width: 8%;
}

th:nth-child(5) {
  width: 24%;
}

table[data-list="fjoerfehold"] th:nth-child(1) {
  width: 32%;
}

table[data-list="fjoerfehold"] th:nth-child(2) {
  width: 22%;
}

table[data-list="fjoerfehold"] th:nth-child(3) {
  width: 18%;
}

table[data-list="fjoerfehold"] th:nth-child(4) {
  width: 28%;
}

table[data-list="hobbyfjoerfehold"] th:nth-child(1) {
  width: 30%;
}

table[data-list="hobbyfjoerfehold"] th:nth-child(2) {
  width: 24%;
}

table[data-list="hobbyfjoerfehold"] th:nth-child(3) {
  width: 18%;
}

table[data-list="hobbyfjoerfehold"] th:nth-child(4) {
  width: 28%;
}

th:last-child,
td:last-child {
  text-align: right;
}

th[data-numeric="true"],
td[data-numeric="true"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td p {
  margin: var(--space-1) 0 0;
  color: var(--color-text-muted);
  font-size: var(--text-muted);
}

td .row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  justify-content: flex-end;
  margin: calc(var(--space-2) * -1) 0; /* offset compact buttons so the row
                                          height stays driven by text */
}

td .row-actions :is(a, button) {
  white-space: nowrap;
}

td .row-actions form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.delete-confirmation {
  display: grid;
  gap: var(--space-5);
  background: var(--color-danger-surface);
  border: var(--border-width) solid var(--color-danger-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.delete-confirmation h2 {
  margin: 0;
  color: var(--color-danger-text-strong);
  font-size: var(--heading-sm);
}

/* Keep the summary page content aligned with the step indicator and the
 * rest of the readable column instead of stretching across the full page. */
main.page > .summary-section:not(.panel),
main.page > .summary-section:not(.panel) ~ form {
  width: min(100%, var(--content-width-readable));
  justify-self: start;
}

.summary-section__header,
.summary-block__header {
  display: grid;
  gap: var(--space-2);
}

.summary-section__header > a,
.summary-block__header > a {
  justify-self: start;
}

.summary-block-list {
  display: grid;
  gap: var(--space-5);
}

.summary-block {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5) 0 0;
  border-top: var(--border-width) solid var(--color-border-subtle);
}

.summary-block:first-child {
  padding-top: 0;
  border-top: 0;
}

.summary-block h3,
.update-building h3,
.update-room h3 {
  margin: 0;
  font-size: var(--heading-2xs);
  line-height: var(--line-height-tight);
  color: var(--color-text-strong);
}

.summary-block p,
.update-room p {
  margin: 0;
}

.summary-list {
  display: grid;
  grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr);
  column-gap: var(--space-5);
  row-gap: 0;
  margin: 0;
}

.summary-list--stacked {
  grid-template-columns: minmax(0, 1fr);
  row-gap: var(--space-2);
}

.summary-list dt,
.summary-list dd {
  padding-bottom: var(--space-3);
  border-bottom: var(--border-width) solid var(--color-border-subtle);
}

.summary-list dt:last-of-type,
.summary-list dd:last-of-type {
  border-bottom: 0;
  padding-bottom: 0;
}

.summary-list dt {
  color: var(--color-text-strong);
  font-weight: var(--font-weight-bold);
}

.summary-list dd {
  margin: 0;
  color: var(--color-text-strong);
  overflow-wrap: break-word;
}

.summary-list--stacked dd {
  padding-bottom: var(--space-4);
}

.summary-sublist {
  display: grid;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.summary-subitem {
  display: grid;
  gap: var(--space-2);
  padding-top: var(--space-4);
  border-top: var(--border-width) solid var(--color-border-subtle);
}

.summary-subitem__title {
  font-weight: var(--font-weight-bold);
  color: var(--color-text-strong);
}

.update-overview {
  display: grid;
  gap: var(--space-6);
  /* Match the step indicator and the rest of the flow (readable measure). */
  max-width: var(--content-width-readable);
}

.update-overview__intro,
.update-overview__section {
  display: grid;
  gap: var(--space-3);
}

.update-overview__intro {
  width: 100%;
  padding: var(--space-5);
  background: var(--color-info-surface);
  border: var(--border-width) solid var(--color-info-border);
  border-radius: var(--radius-lg);
}

.update-overview__intro h2,
.update-overview__section > h2 {
  margin: 0;
  font-size: var(--heading-sm);
  color: var(--color-text-strong);
}

.update-overview__intro h2 {
  color: var(--color-info-text);
}

.update-overview__intro p,
.update-overview__section > p {
  margin: 0;
  max-width: 60ch;
}

.update-overview__intro p {
  color: var(--color-info-text);
}

.update-overview__section > h2,
.building-rooms__header h4 {
  color: var(--color-text-subtle);
}

.update-building-list,
.update-room-list {
  display: grid;
  gap: var(--space-5);
}

.update-building {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-6) 0;
  border-top: var(--border-width) solid var(--color-border-subtle);
}

.update-building:first-child {
  padding-top: 0;
  border-top: 0;
}

.update-building__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: start;
}

.update-building__header h3 {
  margin: 0;
  font-size: var(--heading-sm);
  line-height: var(--line-height-tight);
}

.building-location {
  max-width: none;
}

.building-map-preview {
  gap: var(--space-2);
  max-width: none;
}

.building-map-preview__canvas {
  aspect-ratio: auto;
  height: 10rem;
  min-height: 0;
  border-radius: var(--radius-md);
}

.update-room {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: var(--space-5);
  align-items: end;
  padding: var(--space-5) 0;
  border-top: var(--border-width) solid var(--color-border-subtle);
}

.building-rooms {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border: var(--border-width) solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  background: var(--color-bg-tinted);
}

.building-rooms__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: center;
}

.building-rooms__header h4,
.building-rooms__header p {
  margin: 0;
}

.building-rooms__header h4 {
  font-size: var(--heading-xs);
}

.building-rooms__header p {
  color: var(--color-text-muted);
}

.update-room:first-child {
  border-top: 0;
  padding-top: 0;
}

.update-room__content {
  display: grid;
  gap: var(--space-3);
}

.update-room__facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: var(--space-4);
  row-gap: var(--space-1);
  margin: 0;
  max-width: 44rem;
}

.update-room__facts dt,
.update-room__facts dd {
  margin: 0;
  line-height: var(--line-height-relaxed);
}

.update-room__facts dt {
  color: var(--color-text-muted);
  font-size: var(--text-muted);
}

.update-room__facts dd {
  color: var(--color-text-strong);
  font-size: var(--text-default);
  font-weight: var(--font-weight-medium);
  overflow-wrap: break-word;
}

.update-room__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: flex-end;
}

.update-building__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  color: var(--color-text-muted);
  font-size: var(--text-muted);
}

.update-building__actions form {
  display: inline-flex;
  margin: 0;
}

.update-room-list__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

@media (max-width: 48rem) {
  .summary-list {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--space-2);
  }

  .summary-list dd {
    padding-bottom: var(--space-4);
  }

  .update-room {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .building-rooms__header {
    grid-template-columns: minmax(0, 1fr);
  }

  .update-building__header {
    grid-template-columns: minmax(0, 1fr);
  }

  .update-room__facts {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0;
  }

  .update-room__facts dd + dt {
    margin-top: var(--space-3);
  }

  .update-room__actions {
    justify-content: stretch;
  }

  .update-room__actions .button {
    width: 100%;
  }

  .update-building__actions {
    align-items: stretch;
  }

  .update-building__actions .button,
  .update-building__actions button {
    width: 100%;
  }

  .update-building__actions form {
    width: 100%;
  }
}

/* Mobile-stacked table — when the viewport is narrow, each row becomes a
 * stacked card and each cell shows its column label via data-th. */
@media (max-width: 40rem) {
  table[data-mobile="stacked"] thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  table[data-mobile="stacked"] tr {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-5);
    border-bottom: var(--border-width) solid var(--color-border-subtle);
  }
  table[data-mobile="stacked"] tr:hover {
    background: var(--color-surface);
  }
  table[data-mobile="stacked"] td {
    border: none;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr);
    gap: var(--space-3);
    align-items: baseline;
    text-align: left;
  }
  table[data-mobile="stacked"] td::before {
    content: attr(data-th);
    color: var(--color-text-muted);
    font-size: var(--text-muted);
    font-weight: var(--font-weight-medium);
  }
  table[data-mobile="stacked"] td[data-numeric="true"] {
    text-align: left;
  }
  table[data-mobile="stacked"] td p {
    grid-column: 1;
  }
  table[data-mobile="stacked"] td:first-child,
  table[data-mobile="stacked"] td:last-child {
    grid-template-columns: minmax(0, 1fr);
  }
  table[data-mobile="stacked"] td:first-child::before,
  table[data-mobile="stacked"] td:last-child::before {
    display: none;
  }
  table[data-mobile="stacked"] td:first-child a {
    font-weight: var(--font-weight-bold);
  }
  table[data-mobile="stacked"] td .row-actions {
    margin: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding-top: var(--space-1);
  }
}

/* ============================================================
 *  Step indicator
 * ============================================================ */

.steg-indikator {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  /* Use the readable measure so the stepper aligns with the rest of the
   * flow (panel pages, summary, and the steder overview all use the same
   * readable width). */
  width: min(100%, var(--content-width-readable));
  justify-self: start;
}

.steg-indikator__label {
  font-size: var(--text-muted);
  color: var(--color-text-subtle);
  margin: 0;
}

.steg-indikator__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: var(--space-2);
}

.steg-indikator__segment {
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-border-subtle);
}

.steg-indikator__segment--filled {
  background: var(--color-accent);
}

/* ============================================================
 *  Reduced motion
 * ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.001s !important;
    animation-duration: 0.001s !important;
  }
}
