/* The quiet corners of the dashboard: the sign-in and loading screens, the Settings list and its form pages, Safety and Logs.
   Only tokens from theme.css (light and dark follow from them), no raw colours, no inline styles. The grouped list, the
   segmented control, the ring, chips, disclosures and skeletons are the shared components (components.css). */

/* ============================== sign-in and loading ============================== */

/* One centred card on a soft wash of the accent with the fine grain on top; the loading screen is the same stage with just
   the mark, so nothing jumps when the card replaces it. */
.auth-screen {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--space-24) var(--space-20);
  background: radial-gradient(110% 60% at 50% -8%, var(--accent-weak), transparent 70%), var(--bg);
}

.auth-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url('/img/grain-texture.webp') 0 0 / 154px 154px;
  opacity: var(--grain-opacity);
  pointer-events: none;
}

.auth-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, 400px);
  padding: var(--space-32) var(--space-24) var(--space-24);
  border: 1px solid var(--border);
  border-radius: var(--radius-16);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  text-align: center;
}

/* The mark on its own tile. The mark has one ink and no reversed version, so the tile is white in both themes. */
.auth-tile {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid var(--border);
  border-radius: var(--radius-16);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.auth-tile .logomark {
  padding: 0;
  border-radius: 0;
  background: none;
}

.auth-title {
  margin: var(--space-16) 0 var(--space-4);
  font-size: var(--display-xs-size);
  line-height: var(--display-xs-line);
  letter-spacing: -0.02em;
}

.auth-sub {
  margin: 0;
  color: var(--text-2);
  font-size: var(--text-md-size);
  line-height: var(--text-md-line);
}

.auth-demo {
  margin: var(--space-16) 0 0;
  padding: var(--space-4) var(--space-12);
  white-space: normal;
  text-align: center;
}

.auth-form {
  width: 100%;
  margin-top: var(--space-24);
  text-align: left;
}

.auth-form .field {
  margin-bottom: var(--space-16);
}

.auth-form input {
  min-height: 48px;
}

.auth-form .form-msg {
  min-height: 0;
  margin: 0;
  text-align: center;
}

.auth-form .form-msg:not(:empty) {
  margin-bottom: var(--space-12);
}

.auth-form #login-submit {
  width: 100%;
  min-height: 48px;
}

.auth-boot {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-boot p {
  margin: var(--space-12) 0 0;
  color: var(--text-2);
}

/* ============================== forms (the Settings pages and any form from forms.js) ============================== */

/* Spinners take room the unit needs; the arrow keys still step a number. */
.set-form input[type='number'] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.set-form input[type='number']::-webkit-inner-spin-button,
.set-form input[type='number']::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.set-form .fields {
  gap: var(--space-16);
}

.set-form .field > label {
  color: var(--text-strong);
}

/* A long text (notes, JSON) takes the row. */
.set-form .fields > .field:has(textarea) {
  grid-column: 1 / -1;
}

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

/* A number with its unit inside the field: the field is the box, the number and the unit sit in it. The bracketed unit in the
   label stays in the text for assistive technology (and every message that quotes the label) but is not drawn twice. */
.input-wrap {
  display: flex;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--control-border);
  border-radius: var(--radius-8);
  background: var(--surface-2);
  box-shadow: var(--shadow-xs);
}

.input-wrap:focus-within {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  box-shadow: var(--focus-ring-brand);
}

.input-wrap:has(input:disabled) {
  background: var(--fill);
}

.input-wrap input,
.input-wrap input:focus-visible {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  box-shadow: none;
}

.input-unit {
  flex: none;
  padding-right: var(--space-14);
  color: var(--text-2);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
  white-space: nowrap;
}

.has-unit .label-unit {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* A choice list keeps the platform's picker and gets the design system's chevron. */
.select-wrap {
  position: relative;
}

.select-wrap select {
  padding-right: var(--space-40);
  text-overflow: ellipsis;
  appearance: none;
  -webkit-appearance: none;
}

.select-wrap > .eh-icon {
  position: absolute;
  top: 50%;
  right: var(--space-12);
  margin-top: -10px;
  color: var(--text-2);
  pointer-events: none;
}

/* A yes/no is a switch: the real checkbox, drawn as the kit's switch (46 x 26, outline when off, brand fill when on), with the
   label on the left. Switches that follow each other read as one list with hairlines between. */
.set-form .fields > .field.check {
  grid-column: 1 / -1;
  padding: var(--space-4) 0;
}

.set-form .fields > .field.check + .field.check {
  margin-top: calc(-1 * var(--space-16));
  padding-top: var(--space-8);
  border-top: 1px solid var(--border);
}

.set-form .field.check label {
  flex-direction: row-reverse;
  justify-content: space-between;
  gap: var(--space-16);
  cursor: pointer;
}

.check-text {
  flex: 1 1 auto;
  min-width: 0;
}

.set-form .field.check .hint {
  margin-top: 0;
  padding-right: calc(46px + var(--space-16));
}

.field.check input.switch {
  position: relative;
  flex: none;
  width: 46px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: 2px solid var(--text-faint);
  border-radius: var(--radius-full);
  background: var(--fill);
  box-shadow: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition:
    background-color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out);
}

.field.check input.switch::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 3px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: var(--radius-full);
  background: var(--text-faint);
  transition:
    transform var(--dur-2) var(--ease-out),
    background-color var(--dur-2) var(--ease-out);
}

.field.check input.switch:checked {
  border-color: var(--accent);
  background: var(--accent-solid);
}

.field.check input.switch:checked::before {
  transform: translateX(20px);
  background: var(--text-on-accent);
}

.field.check input.switch:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  box-shadow: var(--focus-ring-brand);
}

.field.check input.switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Forced colours (Windows high contrast) drop every background: the switch keeps its shape (an edge, a knob) in system colours. */
@media (forced-colors: active) {
  .field.check input.switch {
    forced-color-adjust: none;
    border-color: ButtonText;
    background: Canvas;
  }

  .field.check input.switch::before {
    background: ButtonText;
  }

  .field.check input.switch:checked {
    border-color: Highlight;
    background: Highlight;
  }

  .field.check input.switch:checked::before {
    background: HighlightText;
  }

  .field.check input.switch:disabled {
    border-color: GrayText;
  }
}

/* Fieldsets (a PV array, a flexible load, the Home Assistant entities) are cards inside the section. */
.set-fieldset {
  padding: var(--space-16);
  background: var(--surface);
}

.set-fieldset > legend {
  padding: 0 var(--space-8);
  font-size: var(--text-md-size);
  line-height: var(--text-md-line);
}

.set-fieldset > .row {
  margin-top: var(--space-16);
}

.set-fieldset > .fields + .fields,
.set-fieldset > .fields + .row {
  margin-top: var(--space-16);
}

/* ============================== the save bar ============================== */

.set-form {
  display: grid;
  gap: var(--space-16);
  min-width: 0;
}

.set-form > .form-msg {
  margin: 0;
}

.save-bar {
  position: sticky;
  z-index: 10;
  /* clear of the floating tab bar (56px, 16px from the edge) */
  bottom: calc(var(--space-16) + 56px + var(--space-12) + env(safe-area-inset-bottom, 0px));
  padding: var(--space-12);
  border: 1px solid var(--border);
  border-radius: var(--radius-16);
  background: var(--surface-raised);
  box-shadow: var(--shadow-md);
}

@media (min-width: 1024px) {
  .save-bar {
    bottom: var(--space-16);
  }
}

.save-bar .form-msg {
  min-height: 0;
  max-height: 30vh;
  margin: 0;
  overflow-y: auto;
}

.save-bar .form-msg:not(:empty) {
  margin-bottom: var(--space-8);
}

.save-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
}

.save-row button.primary {
  flex: 1 1 auto;
  min-height: 48px;
}

@media (min-width: 640px) {
  .save-row button.primary {
    flex: 0 0 auto;
    min-width: 160px;
    margin-left: auto;
  }
}

.save-unsaved {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: var(--space-8);
  color: var(--text-2-strong);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
  font-weight: var(--weight-medium);
}

.save-dot {
  width: var(--space-8);
  height: var(--space-8);
  border-radius: var(--radius-full);
  background: var(--warn);
}

/* Confirm this specification / Approve this baseline: their own block after the bar. */
.save-extra {
  display: grid;
  gap: var(--space-8);
}

.save-extra button {
  min-height: 48px;
}

@media (min-width: 640px) {
  .save-extra {
    display: flex;
    flex-wrap: wrap;
  }
}

/* ============================== settings sub-pages ============================== */

.settings-page {
  gap: var(--space-16);
}

/* The page title is in the header: the form's own card has no frame of its own, its sections are the cards. */
.settings-page > .card {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.set-intro {
  margin: 0 0 var(--space-16);
  color: var(--text-2);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
}

.set-sections,
.set-stack {
  display: grid;
  gap: var(--space-16);
  min-width: 0;
}

.set-section {
  display: grid;
  gap: var(--space-16);
  min-width: 0;
  padding: var(--space-16);
  border: 1px solid var(--border);
  border-radius: var(--radius-12);
  background: var(--surface);
}

.set-section-title {
  margin: 0;
  font-size: var(--text-md-size);
  line-height: var(--text-md-line);
}

.set-sub {
  display: grid;
  gap: var(--space-12);
}

.set-sub + .set-sub {
  padding-top: var(--space-16);
  border-top: 1px solid var(--border);
}

.set-sub-title {
  margin: 0;
  color: var(--text-2);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
  font-weight: var(--weight-medium);
}

.set-note {
  margin: 0;
  color: var(--text-2);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
}

.set-status {
  display: flex;
}

.set-loading {
  padding: var(--space-16) var(--space-4);
}

.set-loading-form {
  display: grid;
  gap: var(--space-16);
  padding: 0;
}

.set-error {
  display: grid;
  gap: var(--space-12);
}

/* The list: the status of each integration under its row, as a last item of the card. */
.ui-list-item.conn-item::before {
  display: none;
}

.conn-item {
  padding: 0 var(--space-16) var(--space-12) calc(var(--space-16) + 40px + var(--space-12));
}

.conn-list {
  display: grid;
  gap: var(--space-8);
  margin: 0;
  padding: 0;
  list-style: none;
}

.conn-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  min-height: 28px;
}

.conn-name {
  color: var(--text-2-strong);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
  font-weight: var(--weight-medium);
}

/* Settings that are a button or a sentence of explanation: Security. */
.settings-page .set-section .row button.danger {
  min-height: 48px;
}

/* A status line that has nothing to say takes no room (it stays in the page for assistive technology). */
.set-section > .form-msg {
  min-height: 0;
  margin: 0;
}

.set-section > .form-msg:empty {
  margin-top: calc(-1 * var(--space-16));
}

/* ============================== appearance ============================== */

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

@media (min-width: 640px) {
  .theme-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* A choice card: a picture of the dashboard, the name and what it does. The radio is the whole card, invisible but real. */
.theme-card {
  position: relative;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-16);
  margin: 0;
  padding: var(--space-12);
  border: 2px solid var(--control-border, var(--border-strong));
  border-radius: var(--radius-16);
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color var(--dur-2) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out);
}

@media (min-width: 640px) {
  .theme-card {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: var(--space-12);
    padding: var(--space-12) var(--space-12) var(--space-16);
  }
}

.theme-card:hover {
  border-color: var(--text-2);
}

.theme-card:has(.theme-radio:checked) {
  border-color: var(--accent);
  box-shadow: var(--focus-ring-brand);
}

.theme-card:has(.theme-radio:focus-visible) {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

.theme-radio {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.theme-text {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
  padding-right: var(--space-24);
}

@media (min-width: 640px) {
  .theme-text {
    padding-right: 0;
  }
}

.theme-name {
  color: var(--text);
  font-size: var(--text-md-size);
  line-height: var(--text-md-line);
  font-weight: var(--weight-semibold);
}

.theme-text .hint {
  margin: 0;
}

.theme-check {
  position: absolute;
  top: 50%;
  right: var(--space-16);
  z-index: 1;
  display: grid;
  margin-top: -10px;
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--accent);
  opacity: 0;
  transform: scale(0.7);
  transition:
    opacity var(--dur-2) var(--ease-out),
    transform var(--dur-2) var(--ease-out);
}

@media (min-width: 640px) {
  .theme-check {
    top: var(--space-20);
    right: var(--space-20);
    margin-top: 0;
  }
}

.theme-card:has(.theme-radio:checked) .theme-check {
  opacity: 1;
  transform: none;
}

/* The picture: each theme drawn in its own fixed colours (the palette scales, which do not change with the theme). */
.theme-swatch {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-10);
}

.sw-pane {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-8);
}

.sw-light {
  background: var(--white);
}

.sw-dark {
  background: var(--gray-900);
}

.sw-kind-system .sw-dark {
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.sw-bar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.sw-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
}

.sw-pill {
  width: 30%;
  height: 4px;
  border-radius: var(--radius-full);
}

.sw-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-6);
  border-radius: var(--radius-6);
}

.sw-line {
  width: 80%;
  height: 4px;
  border-radius: var(--radius-full);
}

.sw-line.short {
  width: 50%;
}

.sw-chip {
  width: 36%;
  height: 8px;
  margin-top: auto;
  border-radius: var(--radius-full);
}

.sw-light .sw-dot,
.sw-light .sw-chip {
  background: var(--brand-600);
}

.sw-light .sw-pill {
  background: var(--gray-200);
}

.sw-light .sw-card {
  background: var(--gray-100);
}

.sw-light .sw-line {
  background: var(--gray-300);
}

.sw-dark .sw-dot,
.sw-dark .sw-chip {
  background: var(--brand-300);
}

.sw-dark .sw-pill {
  background: var(--gray-700);
}

.sw-dark .sw-card {
  background: var(--gray-800);
}

.sw-dark .sw-line {
  background: var(--gray-600);
}

/* ============================== safety ============================== */

.safety-hero {
  display: flex;
  align-items: center;
  gap: var(--space-20);
}

.safety-hero-text {
  min-width: 0;
}

.safety-hero-text h2 {
  margin: 0;
  color: var(--text-2);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
  font-weight: var(--weight-medium);
}

.safety-score {
  margin: var(--space-2) 0 var(--space-8);
  font-size: var(--text-xl-size);
  line-height: var(--text-xl-line);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
}

/* The count of what is outstanding may be long (larger text, a narrow phone): it wraps instead of running out of its card. */
.safety-status {
  max-width: 100%;
  height: auto;
  min-height: 24px;
  white-space: normal;
}

/* A setting of the server's environment inside a sentence (LIVE_CONTROL_ENABLED): what the owner has to type. */
.env-name {
  padding: 0 var(--space-4);
  border-radius: var(--radius-4);
  background: var(--fill);
  color: var(--text);
  font-size: max(12px, 0.88em);
  overflow-wrap: anywhere;
}

.ring-score {
  display: grid;
  gap: var(--space-2);
  line-height: 1;
}

.ring-score strong {
  font-size: var(--display-xs-size);
  line-height: 1;
  font-weight: var(--weight-semibold);
}

.ring-score span {
  color: var(--text-2);
  font-size: var(--text-xs-size);
  font-weight: var(--weight-regular);
}

.safety-loading {
  display: grid;
  gap: var(--space-20);
}

.check-group {
  margin-top: var(--space-20);
}

.check-title {
  margin: 0 0 var(--space-4);
  color: var(--text-2);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
  font-weight: var(--weight-medium);
}

.check-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list .check-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-12);
  padding: var(--space-12) 0;
}

.check-list .check-item + .check-item {
  border-top: 1px solid var(--border);
}

.check-list .check-item .icon {
  margin-top: var(--space-2);
}

/* What has not passed yet is amber (not finished), never red (red is for faults); what is not known is grey. */
.check-list .check-item.fail .icon {
  color: var(--warn);
}

.check-list .check-item.unknown .icon {
  color: var(--text-2);
}

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

.check-label {
  font-size: var(--text-md-size);
  line-height: var(--text-md-line);
}

.check-detail {
  color: var(--warn-text);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
}

.check-item.unknown .check-detail {
  color: var(--text-2);
}

.readiness .ui-disclosure {
  margin-top: var(--space-12);
}

.readiness .ui-disc-body .notice {
  margin: 0;
}

.safety-stack {
  display: grid;
  gap: var(--space-24);
  min-width: 0;
}

.safety-card > h2 {
  margin-bottom: var(--space-8);
}

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

@media (min-width: 640px) {
  .test-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.test-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  padding: var(--space-16);
  border: 1px solid var(--border);
  border-radius: var(--radius-12);
  background: var(--surface-2);
}

.test-card p {
  margin: 0;
}

.test-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-8);
}

.test-head h3 {
  min-width: 0;
}

.test-head .badge {
  flex: none;
}

.test-card button {
  align-self: flex-start;
  margin-top: auto;
}

.test-last {
  overflow-wrap: anywhere;
}

.bits {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  padding: var(--space-10) 0;
  font-size: var(--text-md-size);
  line-height: var(--text-md-line);
}

.bit + .bit {
  border-top: 1px solid var(--border);
}

.confirm-check {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  margin: 0;
  padding: var(--space-12) var(--space-14);
  border: 1px solid var(--border);
  border-radius: var(--radius-12);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--text-md-size);
  line-height: var(--text-md-line);
  font-weight: var(--weight-regular);
  cursor: pointer;
}

.confirm-check input {
  width: 22px;
  height: 22px;
  margin: 0;
}

.maint-group + .maint-group {
  margin-top: var(--space-20);
  padding-top: var(--space-20);
  border-top: 1px solid var(--border);
}

.maint-group h3 {
  margin-bottom: var(--space-4);
}

.maint-group .caption {
  margin: 0 0 var(--space-12);
}

@media (min-width: 1024px) {
  .safety-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .safety-stack > :first-child {
    grid-column: 1 / -1;
  }

  /* The hero stays at the left while the checks run down the right. */
  .readiness {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    column-gap: var(--space-40);
    align-items: start;
  }

  .readiness .safety-hero {
    grid-column: 1;
    grid-row: 1 / span 4;
    position: sticky;
    top: calc(68px + var(--space-16));
    flex-direction: column;
    align-items: flex-start;
  }

  .readiness > :not(.safety-hero) {
    grid-column: 2;
  }

  .readiness > .check-group {
    margin-top: 0;
  }
}

/* ============================== logs ============================== */

.logs-screen {
  display: grid;
  gap: var(--space-16);
  align-content: start;
}

/* The control names the list, so the card's own title is for assistive technology only. */
.log-pane > .card-head h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.log-pane > .card-head:not(:has(.log-filters)) {
  margin: 0;
}

.log-filters {
  display: grid;
  gap: var(--space-8);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
}

@media (min-width: 640px) {
  .log-filters {
    grid-template-columns: repeat(2, 200px);
    width: auto;
  }
}

.log-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.log-row {
  padding: var(--space-12) 0;
}

.log-row + .log-row {
  border-top: 1px solid var(--border);
}

.log-row:first-child {
  padding-top: 0;
}

.log-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
}

.log-time {
  color: var(--text-2);
  font-size: var(--text-xs-size);
  line-height: var(--text-xs-line);
}

.log-title {
  margin: var(--space-4) 0 0;
  font-size: var(--text-md-size);
  line-height: var(--text-md-line);
  font-weight: var(--weight-medium);
}

.log-detail {
  margin: var(--space-2) 0 0;
  color: var(--text-2);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
}

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

.log-problem {
  color: var(--crit-text);
}

/* The raw record behind an audit title ("Recorded as settings.approveSafeBaseline" and what it saved), folded away. */
.log-more {
  margin-top: var(--space-4);
}

.log-more > summary {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  color: var(--accent);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
  font-weight: var(--weight-medium);
  cursor: pointer;
}

/* The word is small; the thumb gets a 44px target around it. */
.log-more > summary::after {
  content: '';
  position: absolute;
  inset: -10px -12px;
}

.log-more-body {
  padding: var(--space-4) 0 var(--space-4) var(--space-12);
  border-left: 2px solid var(--border);
}

.log-more-body .log-detail:first-child {
  margin-top: 0;
}

.log-retry {
  margin-top: var(--space-12);
}

/* A phone reads the rows; from 640px the same records are a table. */
.log-table-wrap {
  display: none;
}

@media (min-width: 640px) {
  .log-list {
    display: none;
  }

  .log-table-wrap {
    display: block;
  }
}

.log-table th:first-child,
.log-table td:first-child {
  padding-left: var(--space-12);
}

.log-table tbody tr:hover td {
  background: var(--surface-2);
}

.log-table td.nowrap {
  white-space: nowrap;
}

.log-table td .chip {
  vertical-align: top;
}
