/* Brand tokens, layered on top of Bootstrap 5.3's CSS custom properties
   (loaded before this file). Calm and trusted, in the register of Norwegian
   public-health sites: one deep blue, white and a very light blue-grey surface,
   near-black text, green only for success. Teal is the AI's colour (the screen in
   the mark): the mark and a quiet accent line in e-mail and print, never a
   button, a link or body text. Swap values here, not in templates,
   if the palette or font changes. The file name is historical. */
:root {
  /* Every text colour below is at least 4.5:1 (WCAG AA) on white and on the
     light surface, and the running-text ones (ink, slate, muted, links) at least
     7:1 (AAA); core/test_contrast.py checks this file. White text on the
     same colours as a fill is checked too (badges, buttons). */
  --bs-primary: #1F4E8C;
  --bs-primary-rgb: 31, 78, 140;
  --bs-secondary: #4A5560;
  --bs-secondary-rgb: 74, 85, 96;
  /* Muted text (.text-muted, .form-text): the slate above, solid. Bootstrap's is
     the ink at 75% (6.7:1 on white, 6.5:1 on the surface); slate is 7.6:1 and 7.0:1. */
  --bs-secondary-color: #4A5560;
  --bs-secondary-color-rgb: 74, 85, 96;
  --bs-success: #1E7B3C;
  --bs-success-rgb: 30, 123, 60;
  --bs-danger: #B02A37;
  --bs-danger-rgb: 176, 42, 55;
  --bs-link-color: #1F4E8C;
  --bs-link-color-rgb: 31, 78, 140;
  --bs-link-hover-color: #173D70;
  --bs-link-hover-color-rgb: 23, 61, 112;
  --bs-body-bg: #FFFFFF;
  --bs-body-bg-rgb: 255, 255, 255;
  --bs-body-color: #1B1F23;
  --bs-body-color-rgb: 27, 31, 35;
  --bs-tertiary-bg: #F2F6FB;
  --bs-tertiary-bg-rgb: 242, 246, 251;
  --bs-border-color: #D9E2EC;
  --bs-border-radius: 0.75rem;
  --bs-border-radius-lg: 1rem;
  --bs-border-radius-sm: 0.5rem;
  --bs-font-sans-serif: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* The brand blue at full opacity (Bootstrap's is its own blue at 25%,
     about 1.4:1 on white). Used by .focus-ring and the rules below. */
  --bs-focus-ring-color: #1F4E8C;
  /* The edge of inputs, selects and unchecked checkboxes and radios. It is
     their only visible boundary, so it needs 3:1 (WCAG 1.4.11); the general
     --bs-border-color above stays light for cards and tables. */
  --dn-form-border-color: #6B7785;
  /* Teal, the AI's screen in the mark. --rv-teal is for graphics only (3:1 on
     white and the surface, WCAG 1.4.11); --rv-teal-text is the shade for the rare
     teal word (4.5:1). Both checked by core/test_contrast.py. */
  --rv-teal: #1A9AA0;
  --rv-teal-text: #127A7F;
  /* Boxes (#699): every card sits on the surface (--bs-tertiary-bg) with the
     brand edge. Bootstrap draws card, modal and dropdown edges in black at 17.5%,
     a neutral grey; this is the same blue-grey as --bs-border-color. Surface 2 is
     one step deeper: a card's header band and a well inside a card. */
  --bs-border-color-translucent: #D9E2EC;
  --rv-surface-2: #E4ECF5;
  /* Info is the brand blue, never cyan: cyan sits next to the AI's teal. These
     three are what .alert-info reads. */
  --bs-info-text-emphasis: #173D70;
  --bs-info-bg-subtle: #E8EFF8;
  --bs-info-border-subtle: #BFD0E6;
  /* Warning is a warm amber instead of Bootstrap's neon #FFC107: the badges below,
     border-warning on the Overview's cards and the node history's cells. A fill
     only, always with ink text (8.9:1); text in warning colour is the dark
     variant (.text-warning below). */
  --bs-warning: #F0B429;
  --bs-warning-rgb: 240, 180, 41;
}

/* Keyboard focus: one solid brand-blue ring everywhere (#264). Bootstrap sets
   outline:0 on these at the same or higher specificity, so they are listed
   by name; this file loads after Bootstrap, so equal specificity wins. */
:focus-visible,
.btn:focus-visible,
.btn-check:focus-visible + .btn,
.nav-link:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible,
.page-link:focus-visible,
.accordion-button:focus-visible,
.btn-close:focus-visible,
.navbar-toggler:focus-visible,
.dropdown-item:focus-visible {
  outline: 3px solid var(--bs-focus-ring-color);
  outline-offset: 2px;
  box-shadow: none; /* Bootstrap's translucent glow would blur the ring */
}

.form-control,
.form-select,
.form-check-input {
  --bs-border-color: var(--dn-form-border-color);
}

/* The outline above replaces Bootstrap's faint focus glow on fields. */
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--bs-primary);
  box-shadow: none;
}

/* No dark mode is shipped. When one is wanted, redefine the tokens above here:
[data-bs-theme="dark"] { }
*/

.navbar-brand-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  color: var(--bs-primary) !important;
  letter-spacing: -0.01em;
}

/* The brand mark (Settings → Brand, or the committed default) next to the wordmark. */
.navbar-brand-mark {
  height: 2rem;
  width: auto;
}

.hero-section {
  background: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-lg);
  padding-block: 1.5rem;
}

/* Even line lengths, so a wrapped heading doesn't leave two words alone. */
body.family :is(h1, h2, h3, h4, .h1, .h2, .h3, .h4) {
  text-wrap: balance;
}

@media (min-width: 768px) {
  .hero-section {
    padding-block: 2.5rem;
  }
}

.note-card {
  border-left: 4px solid var(--bs-primary);
}

.log-terminal {
  background: #1E1E1E;
  color: #8FE388;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
  border-radius: var(--bs-border-radius-sm);
  padding: 0.75rem 1rem;
  max-height: 240px;
  overflow-y: auto;
}

.log-terminal .log-step {
  color: #7EC3E0;
}

.audio-level-meter {
  height: 0.5rem;
  background: var(--bs-tertiary-bg, #e9ecef);
  border-radius: var(--bs-border-radius-sm);
  overflow: hidden;
}

.audio-level-meter-fill {
  height: 100%;
  width: 0%;
  background: var(--bs-primary);
  transition: width 60ms linear;
}

/* Collapsible sections on a person's page: a quiet disclosure triangle. */
.memory-details > summary {
  cursor: pointer;
  list-style: none;
}
.memory-details > summary::-webkit-details-marker {
  display: none;
}
.memory-details > summary::before {
  content: "\25B8";
  display: inline-block;
  margin-right: 0.4rem;
  transition: transform 0.15s;
}
.memory-details[open] > summary::before {
  transform: rotate(90deg);
}
/* No slide or swing for those who ask for less motion: the disclosure triangle
   turns at once and the level meter jumps instead of sliding. */
@media (prefers-reduced-motion: reduce) {
  .memory-details > summary::before,
  .audio-level-meter-fill {
    transition: none;
  }
}


/* Bootstrap hard-codes its own blue, green, red and grey in these components, so
   the tokens above do not reach them. Same colours, set where Bootstrap reads them. */
.btn-primary {
  --bs-btn-bg: #1F4E8C;
  --bs-btn-border-color: #1F4E8C;
  --bs-btn-hover-bg: #173D70;
  --bs-btn-hover-border-color: #123059;
  --bs-btn-active-bg: #123059;
  --bs-btn-active-border-color: #0E2746;
  --bs-btn-disabled-bg: #1F4E8C;
  --bs-btn-disabled-border-color: #1F4E8C;
  --bs-btn-focus-shadow-rgb: 31, 78, 140;
}
.btn-outline-primary {
  --bs-btn-color: #1F4E8C;
  --bs-btn-border-color: #1F4E8C;
  --bs-btn-hover-bg: #1F4E8C;
  --bs-btn-hover-border-color: #1F4E8C;
  --bs-btn-active-bg: #1F4E8C;
  --bs-btn-active-border-color: #1F4E8C;
  --bs-btn-disabled-color: #1F4E8C;
  --bs-btn-disabled-border-color: #1F4E8C;
  --bs-btn-focus-shadow-rgb: 31, 78, 140;
}
.btn-outline-secondary {
  --bs-btn-color: #4A5560;
  --bs-btn-border-color: #4A5560;
  --bs-btn-hover-bg: #4A5560;
  --bs-btn-hover-border-color: #4A5560;
  --bs-btn-active-bg: #4A5560;
  --bs-btn-active-border-color: #4A5560;
  --bs-btn-disabled-color: #4A5560;
  --bs-btn-disabled-border-color: #4A5560;
  --bs-btn-focus-shadow-rgb: 74, 85, 96;
}
.btn-outline-success {
  --bs-btn-color: #1E7B3C;
  --bs-btn-border-color: #1E7B3C;
  --bs-btn-hover-bg: #1E7B3C;
  --bs-btn-hover-border-color: #1E7B3C;
  --bs-btn-active-bg: #1E7B3C;
  --bs-btn-active-border-color: #1E7B3C;
  --bs-btn-disabled-color: #1E7B3C;
  --bs-btn-disabled-border-color: #1E7B3C;
  --bs-btn-focus-shadow-rgb: 30, 123, 60;
}
.btn-outline-danger {
  --bs-btn-color: #B02A37;
  --bs-btn-border-color: #B02A37;
  --bs-btn-hover-bg: #B02A37;
  --bs-btn-hover-border-color: #B02A37;
  --bs-btn-active-bg: #B02A37;
  --bs-btn-active-border-color: #B02A37;
  --bs-btn-disabled-color: #B02A37;
  --bs-btn-disabled-border-color: #B02A37;
  --bs-btn-focus-shadow-rgb: 176, 42, 55;
}
.btn-success {
  --bs-btn-bg: #1E7B3C;
  --bs-btn-border-color: #1E7B3C;
  --bs-btn-hover-bg: #176330;
  --bs-btn-hover-border-color: #124F26;
  --bs-btn-active-bg: #124F26;
  --bs-btn-active-border-color: #0F4220;
  --bs-btn-disabled-bg: #1E7B3C;
  --bs-btn-disabled-border-color: #1E7B3C;
  --bs-btn-focus-shadow-rgb: 30, 123, 60;
}
.dropdown-menu {
  --bs-dropdown-link-active-bg: #1F4E8C;
}
.pagination {
  --bs-pagination-active-bg: #1F4E8C;
  --bs-pagination-active-border-color: #1F4E8C;
}

/* Bootstrap's yellow text is about 1.6:1 on white; use its own dark yellow-brown. */
.text-warning {
  color: var(--bs-warning-text-emphasis) !important;
}

/* Status badges in the brand's family. Bootstrap sets these with !important,
   so they are overridden by name. Warning stays a solid fill, so "Look" keeps its
   weight next to the solid green and red; info is a quiet blue tag; light is the
   surface with an edge, so it doesn't vanish on a card. */
.text-bg-warning {
  color: #1B1F23 !important;
  background-color: #F0B429 !important;
}
.text-bg-info {
  color: #1F4E8C !important;
  background-color: #E8EFF8 !important;
  box-shadow: inset 0 0 0 1px #BFD0E6;
}
.text-bg-light {
  color: #4A5560 !important;
  background-color: var(--bs-tertiary-bg) !important;
  box-shadow: inset 0 0 0 1px var(--bs-border-color);
}

/* Cards (#699): the surface and the brand edge (from --bs-border-color-translucent
   above), with the header on surface 2. Front page, account page and staff panel
   share this one box. */
.card {
  --bs-card-bg: var(--bs-tertiary-bg);
  --bs-card-cap-bg: var(--rv-surface-2);
}

/* What sits inside a card takes the card's surface instead of showing as a white block. */
.card .table {
  --bs-table-bg: transparent;
}
.card .list-group {
  --bs-list-group-bg: transparent;
}
.card .accordion {
  --bs-accordion-bg: transparent;
}

/* A card inside a card (a note on a person's page) stays white, so it still reads as its own thing. */
.card .card {
  --bs-card-bg: var(--bs-body-bg);
}

/* A set-apart block inside a card or on the page: a transcript, a what-if box, a role that is off.
   Surface 2, so it still shows on a surface card. */
.well {
  background-color: var(--rv-surface-2);
}

/* Table stripes and hover in the brand's blue-grey (Bootstrap's are black at 5% and 7.5%),
   and quiet column heads. */
.table {
  --bs-table-striped-bg: rgba(31, 78, 140, 0.045);
  --bs-table-hover-bg: rgba(31, 78, 140, 0.07);
}
.table > thead > tr > th {
  color: var(--bs-secondary);
  border-bottom: 2px solid var(--bs-border-color);
}

/* The family site is read by people who are often over 60, and by their
   adult children who order: 17px text, 15px small text, 19px lead and
   buttons at least 48px tall. The staff panel does not use this class. */
body.family {
  --bs-body-font-size: 1.0625rem;
  font-size: 1.0625rem;
}

body.family .small,
body.family small {
  font-size: 0.9375rem;
}

body.family .lead {
  font-size: 1.1875rem;
}

/* A comfortable reading width: Bootstrap's 1320px step is too wide for text. */
@media (min-width: 1400px) {
  body.family .container {
    max-width: 1140px;
  }
}

/* The hero headline: 40px from tablets up (phones have their own size below). */
@media (min-width: 768px) {
  body.family .hero-section h1 {
    font-size: 2.5rem;
  }
}

body.family .btn,
body.family .form-control,
body.family .form-select {
  min-height: 3rem;
}

/* A button stretched to 48px keeps its label in the middle, not at the top.
   The gap stands in for the space after an icon, which flex drops. */
body.family .btn:not(.btn-link) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
}

body.family .btn-sm {
  --bs-btn-font-size: 1rem;
  --bs-btn-padding-y: 0.5rem;
}

body.family .btn-link {
  min-height: 0;
}

/* Meldinger's e-mail line (_mail_line.html): its link to the e-mail choices is a 44 px target. */
body.family .mail-line a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

/* Small in-card actions (Edit, Remove, Always use, the pause switch) need a 44 px touch target.
   This comes after the reset above, which would win at the same specificity. */
body.family .card-body .btn-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

/* The public footer (templates/portal/_footer.html): its two link lists and the contact line stack on
   a phone and stand side by side from tablets up; each link is the kit's 44 px link row. */
body.family .site-footer-groups {
  display: grid;
  column-gap: 1.5rem;
}

body.family .site-footer-contact {
  margin-top: 1rem;
}

@media (min-width: 768px) {
  body.family .site-footer-groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* The customer UI kit (issue #1340): the classes of templates/portal/_row_fold.html, _state_card.html,
   _link_row.html and _plan_head.html, and the two rules the customer pages are built to.
   Buttons: one filled button per screen, for the one thing the screen is for; an outline button is a
   second way, under the filled one, never beside it; onward and back are link rows, not buttons. Red
   only for stop, remove and start over; a «Vil du …?» confirm names the action on its OK button. A
   button carries only its words, except the phone on Ring nå.
   Text sizes: 17 px for every sentence a customer reads before deciding, field help included; 15 px
   (.small) only for a date, a count, a caption under a price or a pill label. One page title size
   (the h1 at the h3 size, then at most one lead sentence at body size) and one card title (h5); the
   quiet small title only on a card that holds facts and no control. Marketing pages keep their
   display sizes.
   Every rule here is under body.family and uses the existing tokens only: no colour of its own. */

/* _link_row.html: onward and back, a 44 px block at body size, underlined; a hairline between rows. */
body.family .link-row {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 2.75rem;
  padding-block: 0.5rem;
  font-size: var(--bs-body-font-size);
  text-decoration: none;
}

/* The words are underlined, the arrow is not. */
body.family .link-row > span {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

body.family .link-rows > .link-row + .link-row {
  border-top: 1px solid var(--bs-border-color);
}

body.family .link-rows-heading {
  margin: 1rem 0 0.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
}

/* _row_fold.html: a full-width row, 44 px or taller, the name over its stored value and one chevron
   at the right, turned when the row is open. */
body.family details.row-fold {
  border-bottom: 1px solid var(--bs-border-color);
}

/* The last row in a card or a list ends at the card's own edge. */
body.family .row-fold-wrap:last-child > details.row-fold {
  border-bottom: 0;
}

body.family .row-fold-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2.75rem;
  padding-block: 0.625rem;
  cursor: pointer;
  list-style: none;
}

body.family .row-fold-summary::-webkit-details-marker {
  display: none;
}

body.family .row-fold-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

body.family .row-fold-name {
  font-weight: 600;
}

body.family .row-fold-value {
  color: var(--bs-secondary-color);
  overflow-wrap: anywhere;
}

body.family .row-fold-unsaved {
  font-size: 0.9375rem;
  font-weight: 600;
}

body.family .row-fold-chevron {
  flex-shrink: 0;
  transition: transform 0.15s;
}

body.family details.row-fold[open] > summary .row-fold-chevron {
  transform: rotate(180deg);
}

body.family .row-fold-body {
  padding-bottom: 1rem;
}

/* _state_card.html: the filled button, then a second way under it; full width on a phone. */
body.family .state-card-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

body.family .state-card-actions form {
  margin: 0;
}

body.family .state-card-actions .btn {
  width: 100%;
}

@media (min-width: 576px) {
  body.family .state-card-actions {
    align-items: flex-start;
  }

  body.family .state-card-actions .btn {
    width: auto;
  }
}

/* _plan_head.html: the name and the monthly price on one line, the price at the right; on a narrow
   card the price wraps under the name and stays at the right. */
body.family .plan-head-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}

body.family .plan-head-price {
  margin-inline-start: auto;
  font-weight: 700;
  white-space: nowrap;
}

/* Priser's cards (`stacked`): the name, the conversations a week, then the price, one under the
   other from the left. Each part sits at the same place in every card of the row; what an offer
   adds (the regular price under the green one) comes last, so nothing above it moves. */
body.family .plan-head-stacked {
  display: flex;
  flex-direction: column;
}

body.family .plan-head-stacked .plan-head-top {
  display: contents;
}

body.family .plan-head-stacked .plan-head-count {
  order: 1;
}

body.family .plan-head-stacked .plan-head-price {
  order: 2;
  margin-inline-start: 0;
  margin-top: 0.75rem;
  font-size: 1.25rem;
  white-space: normal;
  text-align: start;
}

body.family .plan-head-stacked .plan-head-price small {
  font-size: 1rem;
}

body.family .plan-head-stacked .plan-head-own {
  order: 3;
}

/* An intro offer in the price slot is a phrase, not a number: it may wrap on a narrow card. It is
   the one green price on the page, so the offer is seen beside the regular prices; the regular
   price under it keeps the muted grey. */
body.family .plan-head-price-intro {
  white-space: normal;
  text-align: end;
  color: var(--bs-success);
}

@media (prefers-reduced-motion: reduce) {
  body.family .row-fold-chevron {
    transition: none;
  }
}

/* Om <navn>: «Vis notatene» takes the row's shape, the chevron in place of the old triangle; a town
   heard on a call sits between two rows with room above it; the note's «Fra samtalen» link is 44 px. */
body.family .memory-details > summary.row-fold-summary::before {
  content: none;
}

body.family details.memory-details[open] > summary .row-fold-chevron {
  transform: rotate(180deg);
}

body.family .row-fold-wrap + .alert {
  margin-top: 1rem;
}

body.family .note-call-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

/* Field help is read before deciding, so it is at body size, not Bootstrap's 0.875em. A pill label
   is 15 px; in rem, so a pill inside a small heading is 15 px too (#1979). */
body.family .form-text {
  font-size: var(--bs-body-font-size);
}

body.family .badge {
  --bs-badge-font-size: 0.9375rem;
}

/* End of the customer UI kit. */

/* Priser: «Most chosen» sits on the card's top edge, so the card's own lines start where the
   other cards' do. */
body.family .plan-badge {
  position: absolute;
  top: 0;
  inset-inline-start: 1rem;
  transform: translateY(-50%);
}

/* Priser: what holds for every plan, one row under the cards; stacked on a phone. */
body.family .plans-common {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 2rem;
}

@media (max-width: 575.98px) {
  body.family .plans-common {
    flex-direction: column;
    align-items: center;
  }
}

/* The fold of a long list is a tap target too. */
.memory-details > summary {
  padding-block: 0.5rem;
}

.person-tabs .nav-link {
  padding: 0.75rem 1rem;
  white-space: nowrap;
}

/* «Pause i ringingen» (U05): a submit button drawn as Bootstrap's switch, so it works without a script. */
.pause-switch {
  min-height: 2.75rem;
  padding-left: 0 !important;
}

.pause-switch .form-check-input {
  float: none;
  width: 2.5em;
  height: 1.25em;
  flex-shrink: 0;
  cursor: pointer;
}

.pause-switch[aria-checked="true"] .form-check-input {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
  background-position: right center;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

/* Four tabs on a 375 px phone (U09), all visible without sideways scrolling: two rows of two
   at the normal text size (15 px is the floor for small text). A long name wraps inside its tab. */
@media (max-width: 575.98px) {
  .person-tabs .nav-item {
    flex-basis: 50%;
  }
  .person-tabs .nav-link {
    white-space: normal;
  }
}

/* Phones: a smaller wordmark and headline. */
@media (max-width: 767.98px) {
  .navbar-brand-wordmark {
    font-size: 1.5rem !important;
  }
  .navbar-brand-mark {
    height: 1.75rem;
  }
  body.family .hero-section h1 {
    font-size: calc(1.3rem + 1.5vw);
  }
}

/* Staff panel: use the desktop width (capped for ultrawide screens) instead of
   Bootstrap's fixed container. The family portal keeps its narrow reading width. */
body.staff {
  /* 1440 px: at 1280 nothing changes, at 1920 the page stops growing (issue #1273). */
  --staff-max: 90rem;
}

/* A page whose main table has nine or more columns (Customers, All calls, Orders) opts into the
   full width with {% block body_class %} staff-full{% endblock %}; the top bar follows it. */
body.staff.staff-full {
  --staff-max: 2000px;
}

body.staff .staff-wide {
  width: 100%;
  max-width: var(--staff-max);
  margin-inline: auto;
  padding-inline: 1rem;
}

/* Settings pages: a fixed-width sidebar beside the content. minmax(0, 1fr) lets the
   content column shrink, so a wide table scrolls inside itself, never the page. */
body.staff .settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}

@media (min-width: 992px) {
  body.staff .settings-layout {
    grid-template-columns: 13rem minmax(0, 1fr);
  }
}

/* The Overview's status rail beside the Inbox (Q2=B, issue #1314): from the xl width it stays in view
   while the queue scrolls, and scrolls itself when it is taller than the window. Under xl it is a
   plain block below the Inbox, so 200% zoom reflows. */
@media (min-width: 1200px) {
  body.staff .overview-rail {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }
}

/* The Activity tabs scroll sideways on a phone. */
body.staff .subnav {
  overflow-x: auto;
  scrollbar-width: none;
}

body.staff .subnav .nav-link {
  white-space: nowrap;
}

/* A box that scrolls sideways fades out at its right edge until it is scrolled to the end
   (static/js/scroll-fade.js sets the classes), so a phone shows that a table or tab row goes on. */
body.staff .is-scrollable:not(.at-end) {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
}

/* A visually hidden table heading (an Actions column) is absolutely positioned; the scroll box is
   its positioning ancestor, so it stays inside the box and the page stays at phone width (#1207). */
body.staff .table-responsive {
  position: relative;
}

/* The Settings drawer on a phone keeps the sidebar's spacing; from 992px offcanvas-lg is a plain column. */
body.staff .offcanvas-lg.offcanvas-start {
  --bs-offcanvas-width: 18rem;
}

@media (max-width: 991.98px) {
  body.staff .offcanvas-body {
    padding-top: 0;
  }
}

/* Long unbroken strings (model names) wrap instead of forcing a scrollbar. */
body.staff .cell-wrap-anywhere {
  overflow-wrap: anywhere;
}

/* Call-days picker (_schedule_picker.html): seven day buttons in one row, also on a phone. */
.schedule-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: .375rem;
}
.schedule-days .btn {
  min-height: 2.75rem;
  padding-left: 0;
  padding-right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.schedule-time-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .75rem;
  margin-bottom: .5rem;
}
.schedule-time-row label { min-width: 5.5rem; }
.schedule-time-row .form-select { width: auto; min-width: 7rem; min-height: 2.75rem; }

/* Env and backup (companion-portal#557): the four steps of a write side by side from 768px, the
   variable groups as folded lines, and the key column wide enough for the longest names. */
body.staff .env-steps {
  padding-left: 1.25rem;
}

@media (min-width: 768px) {
  body.staff .env-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    padding-left: 0;
    list-style-position: inside;
  }
}

/* Health checks: fixed status and name columns from 768px only, so a phone keeps room for the detail. */
@media (min-width: 768px) {
  body.staff .check-status { width: 6rem; }
  body.staff .check-name { width: 16rem; }
}

/* Health checks: a group's heading, its worst state as a word, its counts, then the link to the page
   that fixes it, after the heading rather than inside it (Q17=B, issue #1286). */
body.staff .health-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  margin-bottom: 0.5rem;
}

/* Health checks: the last runs as a status strip inside the Newest run card (Q18=B, issue #1287),
   tighter than the page's own strip since it holds fourteen items. */
body.staff .run-history .status-strip {
  margin-top: 0;
}

@media (min-width: 992px) {
  body.staff .run-history .status-strip dl {
    gap: 0.5rem 1.25rem;
  }
}

/* Customer voices: the select wraps under Save instead of shrinking to its arrow. */
body.staff .customer-voice-select { min-width: 12rem; }

body.staff .env-filter-input {
  width: 16rem;
  max-width: 100%;
}

body.staff details.env-group > summary {
  cursor: pointer;
}

body.staff details.env-group .env-key {
  width: 18rem;
}

body.staff details.env-group .env-problem {
  width: 14rem;
}

/* Staff alerts' switches table (staff_alerts.html, issue #1292): the share input stays narrow; on a phone
   each alert is a block, the switch before its label and each figure named by its column (data-label). */
body.staff .staff-alert-table .staff-alert-percent {
  max-width: 8rem;
}

@media (max-width: 575.98px) {
  body.staff .staff-alert-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  body.staff .staff-alert-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--bs-border-color);
  }

  body.staff .staff-alert-table tbody :is(th, td) {
    display: block;
    padding: 0;
    border: 0;
    text-align: start;
  }

  body.staff .staff-alert-table tbody th[scope="row"] {
    flex: 1 1 calc(100% - 2.5rem);
    min-width: 0;
  }

  body.staff .staff-alert-table tbody td[data-label="On"] {
    order: -1;
  }

  body.staff .staff-alert-table tbody td[data-label]:not([data-label="On"]) {
    flex: 0 0 auto;
    font-size: 0.875em;
  }

  body.staff .staff-alert-table tbody tr > td[data-label="Sent"] {
    margin-left: 2rem;
  }

  body.staff .staff-alert-table tbody td[data-label]:not([data-label="On"])::before {
    content: attr(data-label) ": ";
    color: var(--bs-secondary-color);
  }
}

/* The staff UI kit (companion-portal#1273): the classes the staff page partials use. Every rule is
   under body.staff, and only existing tokens are used, so the customer pages and the contrast test
   see nothing new. */

/* Running text (job lines, help lines, notes, guides) stops at about 75 characters. */
body.staff .measure {
  max-width: 44rem;
}

/* _page_header.html: the way back, then the title and one job line on the left and the page's one
   main action on the right; the status strip and an in-page tab row under them. */
body.staff .page-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

body.staff .page-header-text {
  min-width: 0;
  flex: 1 1 20rem;
}

body.staff .page-header-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* _status_strip.html: one row of label-over-value items that wraps; a two-column grid on a phone. */
body.staff .status-strip {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-sm);
}

body.staff .status-strip dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 1rem;
  margin: 0;
}

@media (min-width: 992px) {
  body.staff .status-strip dl {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 2rem;
  }
}

/* On a phone the strip is one line that opens (plan default 7, static/js/status-strip.js); from
   576px the line is hidden and the strip always open. */
body.staff .status-strip-summary {
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.staff .status-strip-fold[open] > .status-strip-summary {
  margin-bottom: 0.5rem;
}

@media (min-width: 576px) {
  body.staff .status-strip-summary {
    display: none;
  }
}

body.staff .status-strip dt {
  font-size: 0.875em;
  font-weight: 600;
  color: var(--bs-secondary-color);
}

body.staff .status-strip dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Connections' status table is its strip (P84=B, issue #1298): below 576px each service is one block
   (name, where, state, saved and tested, Test) instead of a five-column table. */
@media (max-width: 575.98px) {
  body.staff .connections-strip thead {
    display: none;
  }

  body.staff .connections-strip tr {
    display: block;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--bs-border-color);
  }

  body.staff .connections-strip th,
  body.staff .connections-strip td {
    display: inline-block;
    padding: 0.125rem 0.5rem 0.125rem 0;
    border: 0;
  }
}

/* Fields in cards: a fieldset as a card with its legend as the card title (one heading size), two
   equal columns of cards from 992px, an odd last card across the row; short number boxes. */
body.staff fieldset.field-card {
  min-width: 0;
  padding: 1rem 1.25rem 0.25rem;
}

body.staff fieldset.field-card > legend {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

body.staff .field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem 1.5rem;
}

@media (min-width: 992px) {
  body.staff .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.staff .field-grid > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

body.staff .field-num {
  width: 8rem;
  max-width: 100%;
}

/* Two columns: the work on the left, a rail on the right that stays in view (--even: equal
   siblings; --lead-rail: the rail first, Test call only). One column in source order below 992px. */
body.staff .staff-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}

@media (min-width: 992px) {
  body.staff .staff-cols {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  }

  body.staff .staff-cols--even {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.staff .staff-cols--lead-rail {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  }

  body.staff .staff-rail {
    position: sticky;
    top: 1rem;
    align-self: start;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }

  /* Test call's setup rail (Q10=B): Start and Hang up stay at the rail's foot while the setup above
     them scrolls inside the rail, and the rail is short enough for that foot to sit on the first
     screen under the top bar and the title. Its .row blocks hang 0.5rem past the right edge (the g-3
     gutter), and overflow-y: auto makes overflow-x auto too, so the sideways overflow is hidden. */
  body.staff .test-call-rail {
    max-height: calc(100vh - 9rem);
    overflow-x: hidden;
    scroll-padding-bottom: 7rem;
  }

  body.staff .test-call-rail > .test-call-start {
    position: sticky;
    bottom: 0;
    padding: 0.75rem 0;
    background: var(--bs-body-bg);
    border-top: 1px solid var(--bs-border-color);
  }
}

/* _save_bar.html: Save first, then when it applies; it stays at the bottom of the view while the
   form scrolls, on the page colour with a top edge. Not when printing or on a short viewport. */
body.staff .save-bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-top: 1rem;
  padding: 0.75rem 0;
  background: var(--bs-body-bg);
  border-top: 1px solid var(--bs-border-color);
}

@media print, (max-height: 30rem) {
  body.staff .save-bar {
    position: static;
  }
}

/* The Option form (option_form.html, issue #1301): a control that takes focus scrolls clear of the
   save bar instead of under it. */
body.staff .option-form :is(input, select, textarea, button, summary, a) {
  scroll-margin-bottom: 5rem;
}

/* _fold.html: one marker style; the count reads quieter than the words. */
body.staff details.fold > summary {
  cursor: pointer;
}

body.staff details.fold .fold-count {
  color: var(--bs-secondary-color);
}

body.staff details.fold > .fold-body {
  padding-top: 0.5rem;
}

/* Spoken lines (P60=B, issue #1294): one row per line. The summary is a 44 px tap target: the marker,
   the name and a short state word per language on the first line, when it plays under it, then the
   words in use cut to one line. */
body.staff details.spoken-row > summary {
  cursor: pointer;
  min-height: 2.75rem;
}

body.staff .spoken-row-name {
  font-weight: 600;
  margin-inline-end: 0.5rem;
}

body.staff .spoken-row-states .badge {
  margin-inline-end: 0.25rem;
}

body.staff .spoken-row-help,
body.staff .spoken-row-words {
  display: block;
  font-size: 0.875em;
}

body.staff .spoken-row-help {
  color: var(--bs-secondary-color);
}

body.staff .spoken-row-words {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.staff .spoken-row-body {
  padding-block: 0.75rem 0.25rem;
}

/* _count_chips.html: chips are small outlined links in a wrapping row, never tabs. */
body.staff .chips .chip {
  border-radius: 50rem;
}

/* _subnav.html (issue #1274): a gap before each group of tabs after the first; the group's name is a
   label only screen readers read, since printed group names do not fit the row at 1280 px. */
body.staff .subnav .subnav-gap {
  margin-inline-start: 1.25rem;
}

/* The top bar's Calls item (S1=B, issue #1280): the item's link, then its own 'n live' badge that links
   to Live now, on one line in the desktop bar and in the phone menu. The badge is a link, so it gets a
   tap target of its own and no underline. */
body.staff .nav-calls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
body.staff .nav-calls .nav-live {
  padding: 0.45em 0.7em;
  text-decoration: none;
}

/* The signed-in customer's row on a phone (Hjem · Meldinger · Min konto) and the current place
   in it and in the desktop menu: bold and underlined, not colour alone. */
.account-nav .nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.25rem;
  color: var(--bs-body-color);
}
body.family .navbar-nav .nav-link[aria-current],
.account-nav .nav-link[aria-current] {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 0.4em;
}

/* GPU rentals: one colour per deploy phase (companion-portal#1441, _rental_timings.html). Bootstrap's own
   colour variables, so the bar follows the light and dark themes. */
.rental-phase { background-color: var(--bs-secondary-bg); }
.rental-phase-rent { background-color: var(--bs-secondary); }
.rental-phase-boot { background-color: var(--bs-warning); }
.rental-phase-host-check, .rental-phase-tailscale, .rental-phase-handoff { background-color: var(--bs-info); }
.rental-phase-handoff { opacity: 0.7; }
.rental-phase-checkout, .rental-phase-setup { background-color: var(--bs-primary); opacity: 0.6; }
.rental-phase-bundles { background-color: var(--bs-success); }
.rental-phase-install { background-color: var(--bs-primary); }
.rental-phase-start { background-color: var(--bs-indigo, #6610f2); }
.rental-phase-warm { background-color: var(--bs-danger); opacity: 0.75; }
/* The phase running now on a rental still deploying (#1474, item 5): striped, still in its own colour. */
.rental-phase-running { background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.4) 0 0.3rem, transparent 0.3rem 0.6rem); }
