/* DeployBot UI, pages layer: what belongs to one page (deploy page, site page, site setup
   wizard, error pages, dashboard), plus the fallbacks for no backdrop-filter, reduced
   transparency and forced colours, which override glass surfaces set in this layer. */

@layer pages {
  /* ---- deploy page header */

  .deploy-title {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    flex-wrap: wrap;
  }

  .deploy-title .id {
    font-family: var(--font-mono);
    font-variant-ligatures: none;
    font-feature-settings: "calt" 0;
    font-size: 20px;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
  }

  .deploy-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    font-size: var(--text-5);
    color: var(--muted);
    margin-top: var(--space-2);
  }

  .deploy-meta code {
    font-size: var(--text-4);
    color: var(--text);
  }

  .deploy-meta strong {
    color: var(--text);
  }

  /* ---- site page bits */

  .endpoint {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-4);
    align-items: center;
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--raised);
    margin-bottom: var(--space-4);
  }

  .endpoint .name {
    font-size: var(--text-5);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-3);
  }

  .endpoint .url {
    font-family: var(--font-mono);
    font-variant-ligatures: none;
    font-feature-settings: "calt" 0;
    font-size: var(--text-2);
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
  }

  .endpoint form {
    margin: 0;
  }

  .endpoint > div {
    min-width: 0;
  }

  .deploy-btn .ref-label {
    font-family: var(--font-mono);
    font-variant-ligatures: none;
    font-feature-settings: "calt" 0;
    font-weight: 600;
  }

  /* ---- auth shell */

  /* in pages, not layout with the rest of the auth shell: it overrides the margin of .flash, and
     components outrank layout */
  .auth-card .flash {
    margin-bottom: var(--space-7);
  }

  /* reCAPTCHA, after failed sign-ins. Its own inline styles are allowed on the sign-in page
     (SecurityInterceptor's Content-Security-Policy). */
  .auth-card .g-recaptcha {
    margin-bottom: var(--space-7);
  }

  /* ---- site setup wizard */

  .wizard {
    display: grid;
    grid-template-columns: minmax(200px, 220px) minmax(280px, 1fr);
    gap: var(--space-9);
    align-items: start;
  }

  @media (max-width: 720px) {
    .wizard {
      grid-template-columns: 1fr;
    }
  }

  .wizard-steps {
    position: sticky;
    top: var(--sticky-offset);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
  }

  .wizard-steps form {
    margin-top: var(--space-5);
  }

  .wizard-step {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-5);
    color: var(--muted);

    &.current {
      background: var(--surface);
      color: var(--text);
      font-weight: 600;
    }
  }

  .wizard-step a {
    color: inherit;
    display: flex;
    align-items: center;
    gap: var(--space-4);
  }

  .wizard-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    display: inline-grid;
    place-items: center;
    font-size: var(--text-1);
    font-weight: 600;
    flex: none;
  }

  .wizard-step.current .wizard-num {
    border-color: var(--accent);
    color: var(--accent-text);
  }

  .wizard-step.done .wizard-num {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
  }

  .wizard-card {
    padding: 22px 24px;
    min-height: 360px;
    display: flex;
    flex-direction: column;
  }

  .wizard-card .grow {
    flex: 1;
  }

  .wizard-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    margin-top: 18px;
    padding-top: var(--space-6);
    border-top: 1px solid var(--border);
  }

  .wizard-foot .btn {
    height: 36px;
  }

  .wizard-card .lead {
    font-size: var(--text-5);
    color: var(--muted);
    margin-bottom: var(--space-6);
  }

  .branches {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: var(--space-3) 0;
  }

  .branches .tag {
    cursor: default;
  }

  .branches .tag:hover {
    border-color: var(--border);
    color: var(--text);
  }

  .branches .tag.configured {
    border-color: var(--ok);
    color: var(--ok);
  }

  /* ---- error pages */

  .error-page h1 {
    margin-bottom: var(--space-3);
  }

  .error-page p {
    font-size: var(--text-5);
    color: var(--muted);
  }

  /* ---- site page */

  .page-nav {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin: -8px 0 20px;
    font-size: var(--text-5);
  }

  .page-nav a {
    color: var(--muted);
  }

  .page-nav a:hover,
  .page-nav a:focus-visible {
    color: var(--text);
  }

  .card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: var(--space-6);
  }

  .section-title {
    font-size: 17px;
    font-weight: 600;
    margin: 34px 0 12px;
  }

  .section-head h2 {
    font-size: 17px;
  }

  .row.wrap {
    flex-wrap: wrap;
  }

  /* incident summary: one list of issues, full diagnostics behind "Technical details" */
  .incident {
    background: color-mix(in oklch, var(--fail) 9%, transparent);
    border-color: color-mix(in oklch, var(--fail) 35%, transparent);
    border-radius: var(--radius-xl);
    padding: var(--space-7) var(--space-8);
    margin-bottom: var(--space-8);
  }

  .incident h2 {
    font-size: 16px;
    color: var(--fail);
    margin-bottom: var(--space-3);
  }

  .issue-list {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-5);
    display: grid;
    gap: var(--space-2);
  }

  .issue-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-1) var(--space-4);
    font-size: var(--text-7);
  }

  .issue-summary {
    font-weight: 600;
  }

  .issue-actions {
    font-size: var(--text-5);
  }

  .issue-detail {
    margin-bottom: var(--space-5);
  }

  .issue-detail .lbl,
  .incident details .lbl {
    font-size: var(--text-4);
    font-weight: 600;
    color: var(--muted);
    margin-bottom: var(--space-2);
  }

  .issue-detail .pre {
    color: var(--text);
    font-size: var(--text-4);
    max-height: 320px;
  }

  .issue-detail .help {
    margin-top: var(--space-2);
  }

  /* three current-state cards */
  .state-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-5);
  }

  .state-card {
    border-left: 3px solid var(--tone);
    border-radius: 12px;
    padding: var(--space-6) var(--space-7);
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
  }

  .state-label {
    font-size: var(--text-4);
    font-weight: 600;
    color: var(--muted);
  }

  .state-value {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--tone);
    overflow-wrap: anywhere;
  }

  .state-sub {
    font-size: var(--text-5);
    color: var(--muted);
    overflow-wrap: anywhere;
  }

  .state-more {
    display: grid;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
  }

  #site-state {
    margin-bottom: var(--space-8);
  }

  /* deploy form beside the last deployment; each card only as tall as its content */
  .two-col.deploy-pair {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
    align-items: start;
    margin-top: var(--space-3);
  }

  .form-actions .note {
    font-size: var(--text-4);
    color: var(--muted);
    flex: 1 1 200px;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  /* semantic data tables */
  /* position: relative so the visually hidden (absolute) <caption> is clipped here too */
  .table-scroll {
    overflow-x: auto;
    position: relative;

    &:focus-visible {
      outline: 2px solid var(--focus);
      outline-offset: -2px;
    }
  }

  table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-6);
  }

  table.data th {
    text-align: left;
    font-size: var(--text-2);
    font-weight: 500;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    padding: var(--space-5) var(--space-7);
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
  }

  table.data td {
    padding: var(--space-4) var(--space-7);
    border-bottom: 1px solid color-mix(in oklch, var(--text) 5%, transparent);
    vertical-align: top;
    min-width: 0;
  }

  table.data tbody tr:last-child td {
    border-bottom: 0;
  }

  /* a translucent fill: --raised would read as an opaque block on glass */
  table.data tbody tr:hover {
    background: var(--hover-fill);
  }

  table.data .sub {
    display: block;
    font-size: var(--text-4);
    color: var(--muted);
    margin-top: 2px;
  }

  table.data .clamp {
    max-width: 46ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  table.data td.actions {
    text-align: right;
    white-space: nowrap;
  }

  table.data td.actions form {
    margin: 0;
    display: inline;
  }

  table.data code {
    font-size: var(--text-4);
  }

  .more-link {
    margin-top: var(--space-4);
    font-size: var(--text-5);
  }

  /* configuration as native disclosures */
  .disclosure {
    border-radius: 12px;
    margin-bottom: var(--space-4);
  }

  .disclosure > summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-1) var(--space-6);
    padding: 13px 18px;
    cursor: pointer;
    list-style: none;
  }

  .disclosure > summary::-webkit-details-marker {
    display: none;
  }

  .disclosure > summary::before {
    content: "\25B8";
    color: var(--muted);
    transition: transform .12s;
  }

  .disclosure[open] > summary::before {
    transform: rotate(90deg);
  }

  .disclosure > summary:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: -2px;
    border-radius: 12px;
  }

  .sum-title {
    font-size: 14.5px;
    font-weight: 600;
  }

  .sum-note {
    font-size: var(--text-5);
    color: var(--muted);
  }

  .disclosure > .card {
    border: 0;
    border-top: 1px solid var(--glass-border);
    border-radius: 0 0 12px 12px;
    background: transparent;
    margin: 0;
  }

  .disclosure > .card.mb,
  .disclosure > .mb {
    margin-bottom: 0;
  }

  /* the <summary> already names the section */
  .disclosure .card-head .eyebrow {
    display: none;
  }

  /* ---- dashboard */

  /* status summary: one glass strip of filter links; the current one takes its tone */
  .tiles.summary {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 176px), 1fr));
    gap: var(--space-2);
    padding: var(--space-2);
    margin-bottom: 0;
    border-radius: 18px;
    background: var(--glass-bg);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-highlight), var(--glass-shadow);

    & .tile {
      flex-direction: column;
      align-items: stretch;
      gap: var(--space-4);
      padding: 14px 16px 15px;
      border-radius: 13px;
      background: transparent;
      border: 1px solid transparent;
      transition: background .2s, border-color .2s;
    }
  }

  a.tile {
    color: inherit;
    text-decoration: none;
  }

  .tiles.summary a.tile:hover {
    background: var(--hover-fill);
    text-decoration: none;
  }

  a.tile:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
  }

  .tiles.summary {
    & a.tile.is-current {
      border-color: color-mix(in oklch, var(--tone) 40%, transparent);
      background: linear-gradient(180deg, color-mix(in oklch, var(--tone) 12%, transparent), color-mix(in oklch, var(--tone) 4%, transparent));
    }

    & .tile-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    & .tile-n {
      width: auto;
      height: auto;
      background: none;
      border-radius: 0;
      color: var(--text);
      font: 500 28px/1 var(--font-mono);
      font-variant-ligatures: none;
      font-feature-settings: "calt" 0;
      letter-spacing: -.04em;
    }

    & .tile.is-zero .tile-n {
      color: var(--muted);
    }

    & .tile-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--tone);
      box-shadow: 0 0 8px color-mix(in oklch, var(--tone) 60%, transparent);
    }

    & .tile-text {
      display: flex;
      flex-direction: column;
      gap: 3px;
    }

    & .tile-label {
      font-size: var(--text-6);
      font-weight: 600;
    }

    & .tile-sub {
      font-size: var(--text-3);
      line-height: 1.35;
      color: var(--muted);
      text-wrap: pretty;
    }
  }

  .tile-all {
    --tone: var(--accent);
  }

  /* sites head: heading, count, status filter chip and the toolbar on one row */
  .sites-head {
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    margin: 44px 0 14px;
  }

  .sites-head h2 {
    font-size: 18px;
  }

  .count-chip {
    font: 500 12px var(--font-mono);
    font-variant-ligatures: none;
    font-feature-settings: "calt" 0;
    color: var(--muted);
  }

  /* the site page's history filter */
  .outcome-chips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .outcome-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    height: 24px;
    padding: 0 var(--space-4);
    border-radius: var(--radius-pill);
    font-size: var(--text-3);
    color: var(--muted);
    border: 1px solid var(--border);

    &:hover {
      text-decoration: none;
      color: var(--text);
    }

    &.is-on {
      color: var(--tone, var(--text));
      background: color-mix(in oklch, var(--tone, var(--text)) 12%, transparent);
      border-color: color-mix(in oklch, var(--tone, var(--text)) 35%, transparent);
    }

    .count {
      font-family: var(--font-mono);
      font-variant-ligatures: none;
      font-feature-settings: "calt" 0;
      font-size: var(--text-2);
    }
  }

  .filter-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    height: 24px;
    padding: 0 var(--space-3) 0 var(--space-4);
    border-radius: var(--radius-pill);
    font-size: var(--text-3);
    color: var(--accent-text);
    background: color-mix(in oklch, var(--accent) 8%, transparent);
    border: 1px solid color-mix(in oklch, var(--accent) 35%, transparent);

    &:hover {
      text-decoration: none;
      color: var(--text);
    }
  }

  .sites-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-6);
    margin: 0 0 0 auto;
  }

  .search-field {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    height: 34px;
    width: 280px;
    max-width: 100%;
    padding: 0 var(--space-5);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    background: color-mix(in oklch, var(--surface) 50%, transparent);
    color: var(--muted);
  }

  .search-field:focus-within {
    outline: 2px solid var(--focus);
    outline-offset: 1px;
  }

  .search-field svg {
    flex: none;
  }

  .search-field input[type=search] {
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    outline: 0;
    flex: 1;
    min-width: 0;
    font-size: var(--text-5);
  }

  /* neutral links for repeated names in tables; amber stays for navigation and primary actions */
  .site-link {
    color: var(--text);
    font-weight: 600;
    font-size: var(--text-7);

    &:hover,
    &:focus-visible {
      color: var(--text);
      text-decoration: underline;
      text-underline-offset: 3px;
    }
  }

  table.data.sites {
    & tr.is-disabled {
      opacity: .6;
    }

    /* one summary line per site: every cell but the site name stays on one line */
    & th,
    & td {
      padding-left: var(--space-7);
      padding-right: var(--space-7);
    }

    & td {
      padding-top: var(--space-7);
      padding-bottom: var(--space-7);
      vertical-align: middle;
      white-space: nowrap;
    }

    & tr > :first-child {
      padding-left: var(--space-8);
    }

    & tr > :last-child {
      padding-right: var(--space-8);
    }

    & td.site-cell {
      white-space: normal;
      min-width: 14ch;
    }

    & th.c,
    & td.c {
      text-align: center;
    }

    & .badge {
      vertical-align: 1px;
    }

    & a.badge {
      cursor: pointer;
    }
  }

  /* site block: lettered mark, name (+ prod chip) and slug. A wrapper, not the <td>, is the flex
     box, so the cell stays a table cell. */
  .site-block {
    display: flex;
    align-items: center;
    gap: var(--space-5);
  }

  .site-mark {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-lg);
    display: grid;
    place-items: center;
    font-size: var(--text-5);
    font-weight: 600;
    color: var(--muted);
    background: color-mix(in oklch, var(--text) 5%, transparent);
    border: 1px solid var(--glass-border);
  }

  .site-id {
    display: block;
    min-width: 0;
  }

  .site-name-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
  }

  .prod-chip {
    font: 600 10px var(--font-mono);
    font-variant-ligatures: none;
    font-feature-settings: "calt" 0;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 5px;
    color: var(--prod);
    background: color-mix(in oklch, var(--prod) 10%, transparent);
    border: 1px solid color-mix(in oklch, var(--prod) 25%, transparent);
  }

  /* dependency updates available: a solid amber counter */
  .badge.badge-count {
    min-width: 22px;
    height: 22px;
    padding: 0 var(--space-2);
    justify-content: center;
    border-radius: 7px;
    font: 600 12px var(--font-mono);
    font-variant-ligatures: none;
    font-feature-settings: "calt" 0;
    background: var(--accent);
    color: var(--accent-ink);
  }

  .branch {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    max-width: 100%;
    vertical-align: middle;
  }

  .branch svg {
    flex: none;
    color: var(--muted);
  }

  .branch code {
    font-weight: 500;
  }

  /* long branch names truncate (full value in the title); scroll rather than clip if still too wide */
  table.data.sites td code {
    display: inline-block;
    max-width: 22ch;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
  }

  #sites-table,
  #recent .card {
    border-radius: var(--radius-2xl);
  }

  #sites-table {
    overflow-x: auto;
  }

  table.data.sites {
    & .dirty-mark {
      margin-left: 2px;
      font-weight: 700;
      cursor: help;
    }

    & td.actions {
      width: 1%;
      padding-left: 0;
      white-space: nowrap;
    }

    & td.actions form + form {
      margin-left: var(--space-1);
    }

    & td.actions small.error {
      white-space: normal;
      text-align: left;
    }
  }

  .btn-icon {
    width: 26px;
    padding: 0;
    vertical-align: middle;
  }

  .btn-icon svg {
    display: block;
  }

  .btn-icon[aria-busy="true"] svg {
    display: none;
  }

  .btn-icon[aria-busy="true"]::before {
    width: 10px;
    height: 10px;
  }

  table.data.sites {
    & .btn-icon.btn-xs {
      width: 30px;
      height: 30px;
      border-radius: var(--radius-md);
      border-color: var(--glass-border);
      background: color-mix(in oklch, var(--text) 3%, transparent);
      color: var(--muted);
    }

    & .btn-icon.btn-xs:hover {
      background: color-mix(in oklch, var(--text) 8%, transparent);
      color: var(--text);
    }
  }

  /* keeps the refresh icon in line on rows without a dependency-check button */
  .btn-slot {
    display: inline-block;
    width: 26px;
    height: 26px;
    vertical-align: middle;
  }

  table.data.sites .btn-slot {
    width: 30px;
    height: 30px;
  }

  /* recent deployments: a lighter card, header row visually hidden, a round outcome mark first */
  #recent {
    margin-top: 44px;
  }

  #recent .section-head h2 {
    font-size: 18px;
  }

  #recent .card {
    background: linear-gradient(180deg, color-mix(in oklch, var(--text) 3.5%, transparent), color-mix(in oklch, var(--text) 1.2%, transparent));
  }

  table.data.recent td {
    padding: var(--space-6) var(--space-7);
    vertical-align: middle;
  }

  table.data.recent td.glyph {
    width: 1%;
    padding-left: var(--space-8);
    padding-right: 0;
  }

  .outcome-mark {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--muted);
    background: color-mix(in oklch, currentColor 14%, transparent);
  }

  .outcome-mark svg {
    display: block;
  }

  .outcome-mark:is(.ok, .fail, .warn, .info, .skip) {
    color: var(--tone);
  }

  .status.bare .dot {
    display: none;
  }

  .sha-chip {
    font-weight: 500;
    padding: 3px 7px;
    border-radius: var(--radius-sm);
    background: color-mix(in oklch, var(--text) 5%, transparent);
    border: 1px solid var(--glass-border);
  }

  table.data.recent td.when {
    text-align: right;
    padding-right: var(--space-8);
    white-space: nowrap;
  }

  .card-foot-btn {
    display: block;
    height: 44px;
    line-height: 44px;
    text-align: center;
    font-size: var(--text-5);
    font-weight: 500;
    color: var(--muted);
    border-top: 1px solid var(--glass-border);

    &:hover {
      color: var(--text);
      background: var(--hover-fill);
      text-decoration: none;
    }

    &:focus-visible {
      outline-offset: -2px;
    }
  }

  /* a dependency check running now (Updates cell); same ring as a busy button */
  .spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--info);
    border-top-color: transparent;
    vertical-align: middle;
    animation: db-spin .8s linear infinite;
  }

  table.data tr.empty td {
    color: var(--muted);
  }

  /* below ~760px the dashboard tables become labelled stacked rows (one DOM, no duplicates) */
  @media (max-width: 760px) {
    table.data.stacked thead {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip: rect(0 0 0 0);
    }

    table.data.stacked,
    table.data.stacked tbody,
    table.data.stacked tr,
    table.data.stacked td {
      display: block;
      width: auto;
    }

    table.data.stacked tr {
      padding: var(--space-4) var(--space-6);
      border-bottom: 1px solid var(--glass-border);
    }

    table.data.stacked tbody tr:last-child {
      border-bottom: 0;
    }

    table.data.stacked td {
      border: 0;
      padding: 4px 0 4px 118px;
      position: relative;
      min-height: 26px;
    }

    table.data.stacked td::before {
      content: attr(data-label);
      position: absolute;
      left: 0;
      top: 6px;
      width: 108px;
      font-size: var(--text-3);
      font-weight: 600;
      color: var(--muted);
    }

    table.data.stacked tr.empty td {
      padding-left: 0;
    }

    table.data.stacked tr.empty td::before {
      content: none;
    }

    table.data.stacked .clamp {
      max-width: none;
      white-space: normal;
    }

    /* recent: the outcome mark sits top-right of each stacked row */
    table.data.recent tr {
      position: relative;
    }

    table.data.recent td,
    table.data.recent td.when {
      padding: 4px 0 4px 118px;
      text-align: left;
    }

    table.data.recent td.glyph {
      position: absolute;
      top: 12px;
      right: 14px;
      width: auto;
      padding: 0;
      min-height: 0;
    }

    table.data.recent td.glyph::before {
      content: none;
    }
  }

  /* the sites table has eight columns, so it stacks earlier than the other dashboard tables */
  @media (max-width: 1080px) {
    table.data.sites {
      & thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
      }

      &,
      & tbody,
      & tr,
      & td {
        display: block;
        width: auto;
      }

      & tr {
        padding: var(--space-6) var(--space-7);
        border-bottom: 1px solid var(--glass-border);
        position: relative;
      }

      & td.actions {
        position: absolute;
        top: 16px;
        right: 16px;
        padding: 0;
        min-height: 0;
        width: auto;
      }

      & td.actions::before {
        content: none;
      }

      & tbody tr:last-child {
        border-bottom: 0;
      }

      & td,
      & td.c,
      & tr > :first-child,
      & tr > :last-child {
        border: 0;
        padding: 4px 0 4px 130px;
        position: relative;
        min-height: 26px;
        text-align: left;
        white-space: normal;
      }

      & td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        top: 6px;
        width: 120px;
        font-size: var(--text-3);
        font-weight: 600;
        color: var(--muted);
      }

      /* the site block heads each stacked card, with room for the two row buttons */
      & td.site-cell {
        padding: 0 80px 8px 0;
      }

      & td.site-cell::before {
        content: none;
      }

      & td.actions {
        padding: 0;
      }

      & tr.empty td {
        padding-left: 0;
      }

      & tr.empty td::before {
        content: none;
      }
    }
  }

  /* ---- fallbacks */

  /* fallbacks: no backdrop-filter, or the user asked for less transparency / forced colours */
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .card,
    .disclosure,
    .state-card,
    .tiles.summary,
    .topbar-inner {
      background: color-mix(in oklch, var(--surface) 94%, transparent);
    }
  }

  @media (prefers-reduced-transparency: reduce) {
    .ambient {
      display: none;
    }

    .card,
    .disclosure,
    .state-card,
    .tiles.summary,
    .topbar-inner {
      background: var(--surface);
      -webkit-backdrop-filter: none;
      backdrop-filter: none;
    }

    .incident {
      background: color-mix(in oklch, var(--fail) 7%, var(--surface));
    }
  }

  @media (forced-colors: active) {
    .ambient {
      display: none;
    }

    /* the selected tab and the switch's state survive without colours */
    .seg label:has(input:checked) {
      outline: 2px solid Highlight;
      outline-offset: -2px;
    }

    .switch .track {
      border: 1px solid ButtonText;
      forced-color-adjust: none;
      background: Canvas;
    }

    .switch:has(input:checked) .track {
      background: Highlight;
    }
  }

  /* ---- configuration card on the site page */

  /* Configuration card on the site page */
  .config-kv {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: var(--space-2) var(--space-6);
    margin: 0;
    font-size: var(--text-5);
  }

  .config-kv dt {
    color: var(--muted);
    font-weight: 600;
    font-size: var(--text-4);
  }

  .config-kv dd {
    margin: 0;
    min-width: 0;
  }

  .chips-inline {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
  }

  /* Not deployed: the patterns, what they left out, the suggestion */
  .config-kv .excludes {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }

  .config-kv .excludes form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
  }
}
