:root {
  color-scheme: light dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  line-height: 1.5;
}

body {
  margin: 0;
  background: #f5f7fb;
  color: #18202f;
}

main {
  box-sizing: border-box;
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 28px 20px;
}

.page-header {
  display: grid;
  gap: 10px;
  align-items: start;
  margin-bottom: 14px;
}

.header-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}

h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
}

.brand-title {
  color: #64748b;
  font-size: 16px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.access-summary {
  margin: 0 0 16px;
  color: #475569;
  font-size: 15px;
}

.access-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 20px;
}

.access-form[hidden],
.access-summary[hidden],
.header-actions button[hidden],
.secondary-button[hidden] {
  display: none;
}

.access-form label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
}

input,
button {
  box-sizing: border-box;
  min-height: 42px;
  border-radius: 6px;
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid #c7cfdd;
  padding: 8px 10px;
  background: #fff;
  color: #18202f;
}

button {
  border: 0;
  padding: 8px 16px;
  background: #0f766e;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.secondary-button {
  min-height: 38px;
  border: 1px solid #c7cfdd;
  background: #fff;
  color: #334155;
  white-space: nowrap;
}

.header-actions .secondary-button {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 13px;
}

dialog {
  width: min(420px, calc(100% - 32px));
  border: 0;
  border-radius: 8px;
  padding: 20px;
  background: #fff;
  color: #18202f;
  box-shadow: 0 18px 48px rgb(15 23 42 / 30%);
}

dialog::backdrop {
  background: rgb(15 23 42 / 55%);
}

.share-dialog-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.dialog-close {
  min-height: 36px;
}

.qr-code {
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.qr-code svg {
  display: block;
  width: min(280px, 100%);
  height: auto;
}

.share-installation {
  margin: 0;
  color: #475569;
  overflow-wrap: anywhere;
  text-align: center;
}

.status {
  min-height: 24px;
  margin: 0 0 14px;
  color: #4b5563;
}

.status.error {
  color: #b42318;
  font-weight: 600;
}

.eyebrow {
  margin: 0 0 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.pool-status {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 14px;
  align-items: start;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #d9e0ea;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgb(15 23 42 / 10%);
}

.pool-status h2 {
  margin: 0;
  font-size: 20px;
}

.pool-status-value {
  min-width: 92px;
  border-radius: 999px;
  padding: 6px 12px;
  background: #e5e7eb;
  color: #334155;
  font-weight: 800;
  text-align: center;
}

.pool-status-value.ok {
  background: #dcfce7;
  color: #166534;
}

.pool-status-value.warning {
  background: #fef3c7;
  color: #92400e;
}

.pool-status-value.error {
  background: #fee2e2;
  color: #991b1b;
}

.pool-status-details {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.pool-status-details div {
  min-width: 0;
}

.pool-status-details .pool-status-action {
  grid-column: span 2;
}

.pool-status-details dt {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.pool-status-details dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-weight: 650;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 3px rgb(15 23 42 / 12%);
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef2f7;
  font-size: 12px;
  text-transform: uppercase;
  color: #475569;
}

tr:last-child td {
  border-bottom: 0;
}

.value {
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 700px) {
  main {
    padding: 20px 14px;
  }

  .brand-title {
    font-size: 16px;
  }

  .header-actions .secondary-button {
    width: auto;
    min-height: 32px;
    padding: 5px 9px;
    font-size: 12px;
  }

  dialog {
    padding: 16px;
  }

  .share-dialog-header {
    display: grid;
    gap: 12px;
  }

  .access-summary {
    margin-bottom: 12px;
  }

  .access-form {
    grid-template-columns: 1fr;
    margin-bottom: 16px;
  }

  .pool-status {
    grid-template-columns: 1fr;
  }

  .pool-status-value {
    width: fit-content;
  }

  .pool-status-details {
    grid-template-columns: 1fr 1fr;
  }

  .pool-status-details .pool-status-action {
    grid-column: 1 / -1;
  }

  input,
  button {
    min-height: 46px;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 0;
  }

  td {
    border: 0;
    padding: 6px 12px;
  }

  td::before {
    display: block;
    margin-bottom: 2px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    content: attr(data-label);
  }
}

@media (min-width: 701px) {
  .page-header {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
  }

  .header-actions {
    flex: 0 0 auto;
    justify-content: flex-end;
    margin-top: 3px;
  }
}

@media (prefers-color-scheme: dark) {
  body {
    background: #101827;
    color: #e5e7eb;
  }

  input,
  table,
  dialog,
  .secondary-button {
    background: #172033;
    color: #e5e7eb;
  }

  input {
    border-color: #334155;
  }

  th {
    background: #223047;
    color: #cbd5e1;
  }

  th,
  td,
  tr,
  .qr-code {
    border-color: #2f3b52;
  }

  .qr-code {
    background: #fff;
  }

  .status,
  .access-summary,
  .share-installation,
  .brand-title {
    color: #cbd5e1;
  }

  .status.error {
    color: #fca5a5;
  }
}
