:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #24272b;
  background: #f1f2f4;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background: #292c30;
}

.login-card {
  width: min(100%, 410px);
  padding: 40px;
  border: 1px solid #e8e9eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 60px #0003;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 10px;
  background: #393d42;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}

.eyebrow {
  margin: 24px 0 8px;
  color: #686e75;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 26px;
}

.muted {
  color: #747a82;
}

.login-card .muted {
  margin: 9px 0 26px;
}

form label {
  display: block;
  margin: 18px 0 7px;
  color: #3b4046;
  font-size: 14px;
  font-weight: 600;
}

input {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #d5d8dc;
  border-radius: 7px;
  background: #fff;
  color: #24272b;
  font: inherit;
}

input:focus {
  border-color: #60676f;
  outline: 3px solid #60676f26;
}

.primary-button {
  width: 100%;
  margin-top: 24px;
  padding: 12px;
  border: 0;
  border-radius: 7px;
  background: #34383d;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.primary-button:hover {
  background: #202327;
}

.error-message {
  padding: 10px 12px;
  border-radius: 6px;
  background: #fff0ef;
  color: #a52c26;
  font-size: 14px;
}

.topbar {
  display: flex;
  height: 64px;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  background: #292c30;
  color: #fff;
}

.topbar-brand {
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.account {
  display: flex;
  align-items: center;
  gap: 20px;
  color: #e6e7e8;
  font-size: 14px;
}

.account form {
  margin: 0;
}

.logout-button {
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dashboard-layout {
  display: flex;
  min-height: calc(100vh - 64px);
}

.sidebar {
  width: 230px;
  flex: 0 0 230px;
  padding: 24px 20px;
  background: #34383d;
  color: #fff;
}

.sidebar-label {
  color: #aeb3b9;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
}

.sidebar-link {
  display: block;
  margin: 14px -10px 0;
  padding: 10px;
  border-radius: 6px;
  color: #f0f1f2;
  font-size: 14px;
  text-decoration: none;
}

.sidebar-link:hover {
  background: #ffffff18;
}

.content {
  flex: 1;
  padding: 38px;
  background: #f1f2f4;
}

.content h1 {
  font-size: 24px;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.page-heading .muted {
  margin: 8px 0 0;
}

.add-equipment-button,
.form-submit {
  display: inline-flex;
  width: auto;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 11px 16px;
  text-decoration: none;
}

.equipment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
}

.equipment-card {
  display: block;
  padding: 20px;
  border: 1px solid #676d74;
  border-radius: 12px;
  background: #858b92;
  color: #fff;
  text-decoration: none;
  transition: background-color .15s ease, transform .15s ease;
}

.equipment-card:hover {
  transform: translateY(-2px);
  background: #747b83;
}

.equipment-card h2 {
  overflow-wrap: anywhere;
  margin: 0 0 18px;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.equipment-card h2 span {
  color: #e2e4e6;
  font-size: 15px;
}

.readings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.reading-card {
  display: flex;
  min-height: 60px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 10px;
  border-radius: 7px;
  background: #6f757c;
  color: #f3f4f5;
  font-size: 13px;
  font-weight: 400;
}

.reading-card span {
  color: #fff;
  font-size: 15px;
  font-weight: 400;
}

.empty-state,
.form-panel {
  padding: 26px;
  border: 1px solid #e0e2e5;
  border-radius: 10px;
  background: #fff;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.empty-state p {
  margin: 0;
  color: #747a82;
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: #4c535b;
  font-size: 14px;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.form-panel {
  max-width: 720px;
}

.form-panel .page-heading {
  margin-bottom: 22px;
}

.field-help {
  margin: 7px 0 0;
  color: #747a82;
  font-size: 12px;
}

.threshold-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.secondary-button,
.danger-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  border: 1px solid #cbd0d5;
  border-radius: 7px;
  background: #fff;
  color: #34383d;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  text-decoration: none;
}

.secondary-button:hover {
  background: #f3f4f5;
}

.delete-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #e5e7e9;
}

.api-token-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #e5e7e9;
}

.api-token-section h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.api-token-section p {
  margin: 0 0 14px;
  color: #747a82;
  font-size: 14px;
}

.token-panel {
  max-width: 720px;
}

.token-panel .eyebrow {
  margin-top: 0;
}

.token-panel .muted {
  line-height: 1.5;
}

.token-value {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #d5d8dc;
  border-radius: 7px;
  background: #f7f8f9;
}

.token-value code {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
  color: #34383d;
}

.token-value .secondary-button {
  flex: 0 0 auto;
}

.token-panel > p:first-of-type {
  margin-bottom: 20px;
}

.token-done {
  display: inline-flex;
  width: auto;
  margin-top: 22px;
  padding: 11px 16px;
  text-decoration: none;
}

.danger-button {
  border-color: #b5413b;
  background: #fff;
  color: #a52c26;
}

.danger-button:hover {
  background: #fff0ef;
}

.confirm-dialog {
  width: min(440px, calc(100% - 32px));
  padding: 26px;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 18px 60px #0004;
}

.confirm-dialog::backdrop {
  background: #17191dcc;
}

.confirm-dialog h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.confirm-dialog p {
  color: #626970;
  line-height: 1.5;
}

.confirm-dialog .form-actions {
  justify-content: flex-end;
}

.confirm-dialog form {
  margin: 0;
}

@media (max-width: 600px) {
  .login-card {
    padding: 30px 24px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .threshold-fields {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .sidebar {
    width: 68px;
    flex-basis: 68px;
    padding: 20px 10px;
  }

  .sidebar-label {
    font-size: 9px;
    letter-spacing: .04em;
  }

  .content {
    padding: 28px 20px;
  }
}
