:root {
  --pico-font-size: 95%;
}

.container {
  max-width: 1180px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 0 0.5rem;
}

.site-title {
  margin: 0;
  font-size: 2.35rem;
  line-height: 1;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 1.45rem;
  margin-bottom: 0.5rem;
}

.site-title,
.site-title a {
  color: var(--pico-color);
  text-decoration: none;
}

.nav-actions,
.card-actions,
.history-head {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
}

.instance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

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

.overview-table {
  min-width: 1100px;
  background: color-mix(in srgb, var(--pico-color) 5%, transparent);
  border-radius: 0.8rem;
}

.overview-table td,
.overview-table th {
  vertical-align: top;
}

.table-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-width: 16rem;
}

.compact-button {
  margin: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
}

.notify-col {
  min-width: 12rem;
}

.change-col {
  max-width: 24rem;
}

.change-snippet {
  display: inline-block;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.status-pill {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--pico-muted-border-color);
  color: var(--pico-muted-color);
}

.status-pill.ok {
  background: rgb(34 197 94 / 0.18);
  color: rgb(22 128 60);
}

.status-pill.error {
  background: rgb(239 68 68 / 0.18);
  color: rgb(185 28 28);
}

@media (prefers-color-scheme: dark) {
  .status-pill.ok {
    color: rgb(74 222 128);
  }

  .status-pill.error {
    color: rgb(248 113 113);
  }
}

.response-box {
  max-height: 18rem;
  overflow: auto;
  white-space: pre-wrap;
  border-radius: 0.6rem;
  padding: 1rem;
}

.change-card {
  margin-bottom: 1rem;
}

.change-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
  flex-wrap: wrap;
}

.change-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
}

.transitions-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}

.transition {
  padding: 0.45rem 0.75rem;
  border-left: 3px solid var(--pico-muted-border-color);
  border-radius: 0.3rem;
  background: color-mix(in srgb, var(--pico-color) 4%, transparent);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.transition-error {
  border-left-color: rgb(220 38 38);
  background: rgb(239 68 68 / 0.1);
}

.transition-recovery {
  border-left-color: rgb(22 163 74);
  background: rgb(34 197 94 / 0.1);
}

.transition .field-name {
  font-weight: 600;
}

.transition .duration {
  margin-left: 0.6rem;
  color: var(--pico-muted-color);
  font-style: italic;
}

.change-details summary {
  cursor: pointer;
  color: var(--pico-muted-color);
  font-size: 0.85rem;
  padding: 0.3rem 0;
}

.change-details[open] summary {
  margin-bottom: 0.5rem;
}

.change-details-body {
  padding-top: 0.3rem;
}

.login-wrap {
  max-width: 30rem;
  margin: 8vh auto 0;
}

.error-text {
  color: rgb(185 28 28);
}

@media (prefers-color-scheme: dark) {
  .error-text {
    color: rgb(248 113 113);
  }
}

.logout-link {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0;
}

@media (max-width: 760px) {
  .container {
    padding-inline: 0.9rem;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 0.9rem;
    gap: 0.6rem;
  }

  .site-title {
    font-size: 1.85rem;
  }

  .nav-actions {
    width: 100%;
    justify-content: space-between;
  }

  .table-wrap {
    overflow-x: visible;
  }

  .overview-table {
    min-width: 0;
    width: 100%;
    background: transparent;
    border-radius: 0;
    border-collapse: separate;
    border-spacing: 0 0.7rem;
  }

  .overview-table thead {
    display: none;
  }

  .overview-table,
  .overview-table tbody,
  .overview-table tr,
  .overview-table td {
    display: block;
    width: 100%;
  }

  .overview-table tr {
    background: color-mix(in srgb, var(--pico-color) 5%, transparent);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.8rem;
    padding: 0.85rem 1rem;
  }

  .overview-table td {
    padding: 0.35rem 0;
    border: none;
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    flex-wrap: wrap;
  }

  .overview-table td::before {
    content: attr(data-label);
    flex: 0 0 6.5rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pico-muted-color);
    font-weight: 600;
  }

  .overview-table td > * {
    flex: 1 1 auto;
    min-width: 0;
  }

  .overview-table .cell-instance {
    border-bottom: 1px solid var(--pico-muted-border-color);
    padding-bottom: 0.6rem;
    margin-bottom: 0.3rem;
  }

  .overview-table .cell-instance::before {
    display: none;
  }

  .overview-table .cell-instance a {
    font-size: 1.1rem;
    font-weight: 600;
  }

  .overview-table .cell-actions {
    margin-top: 0.5rem;
    border-top: 1px solid var(--pico-muted-border-color);
    padding-top: 0.7rem;
  }

  .overview-table .cell-actions::before {
    display: none;
  }

  .table-actions {
    min-width: 0;
    width: 100%;
    gap: 0.5rem;
  }

  .table-actions > * {
    flex: 1 1 30%;
  }

  .compact-button {
    width: 100%;
    text-align: center;
    padding: 0.55rem 0.7rem;
    font-size: 0.9rem;
  }

  .change-col {
    max-width: none;
  }

  .notify-col {
    min-width: 0;
    word-break: break-word;
  }

  .card-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .card-actions > *,
  .card-actions form {
    width: 100%;
  }

  .card-actions form button,
  .card-actions [role="button"] {
    width: 100%;
    text-align: center;
  }

  .history-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }

  .response-box {
    font-size: 0.8rem;
    padding: 0.75rem;
    max-height: 14rem;
  }

  h2 {
    font-size: 1.25rem;
  }
}
