:root {
  --bg: #f5f7f9;
  --panel: #ffffff;
  --text: #17212b;
  --muted: #607080;
  --line: #d7dee6;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --danger: #b42318;
  --ok: #176b3a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.app-header {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 32px;
}

.brand {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

nav {
  display: flex;
  gap: 18px;
}

nav a {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

nav a.is-active {
  color: var(--text);
  font-weight: 700;
}

.app-main {
  margin: 0 auto;
  max-width: none;
  padding: 32px clamp(16px, 3vw, 40px) 56px;
  width: 100%;
}

.app-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  padding: 20px 32px;
}

.panel,
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel {
  margin-top: 24px;
  padding: 28px;
}

.notice-panel {
  background: #fffaf0;
  border-color: #f3d399;
}

.auth-panel {
  display: grid;
  gap: 32px;
  grid-template-columns: minmax(0, 0.8fr) minmax(280px, 1fr);
  margin-left: auto;
  margin-right: auto;
  max-width: 1080px;
}

.dashboard-head {
  align-items: center;
  display: flex;
  gap: 24px;
  justify-content: space-between;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.2;
  margin-bottom: 10px;
}

h2 {
  font-size: 20px;
}

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.lead {
  color: var(--muted);
  line-height: 1.7;
}

.stack {
  display: grid;
  gap: 16px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  gap: 6px;
}

input,
select {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 42px;
  padding: 8px 10px;
}

textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 92px;
  padding: 8px 10px;
  resize: vertical;
}

button {
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 42px;
  padding: 10px 16px;
}

button:hover {
  background: var(--accent-dark);
}

.button-danger {
  background: var(--danger);
}

.button-danger:hover {
  background: #8f1d15;
}

.section-head {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.collapsible-panel-head {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.collapsible-panel-head h2 {
  margin: 0;
}

.collapsible-panel-body {
  margin-top: 18px;
}

.web-monitor-registration.is-collapsed,
.pro-upgrade-panel.is-collapsed {
  padding-bottom: 18px;
  padding-top: 18px;
}

.icon-toggle {
  align-items: center;
  background: #eef3f7;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 18px;
  font-weight: 700;
  justify-content: center;
  min-height: 34px;
  padding: 0;
  width: 34px;
}

.icon-toggle:hover {
  background: #dfe8ef;
}

.icon-toggle .toggle-icon {
  line-height: 1;
}

.is-collapsed .toggle-icon-expanded,
.toggle-icon-collapsed {
  display: none;
}

.is-collapsed .toggle-icon-collapsed {
  display: inline;
}

.section-head h2 {
  margin-bottom: 6px;
}

.section-note,
.refresh-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

.refresh-note {
  white-space: nowrap;
}

.inline-form {
  align-items: end;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(160px, 0.7fr) minmax(260px, 1.3fr) auto;
}

.form-link {
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
}

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

.password-form {
  align-items: end;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
}

.pro-upgrade-form {
  align-items: end;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(160px, 0.75fr) minmax(220px, 1fr) auto;
}

.pro-upgrade-form .wide-field {
  grid-column: 1 / -1;
}

.agent-form {
  align-items: end;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
}

.agent-template-form {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.agent-template-form select {
  min-width: 0;
  width: 100%;
}

.agent-template-form button {
  min-height: 36px;
  padding: 8px 12px;
}

.request-summary {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.request-summary div {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 4px;
  padding: 12px;
}

.request-summary dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.request-summary dd {
  display: grid;
  gap: 3px;
  margin: 0;
  overflow-wrap: anywhere;
}

.request-summary small {
  color: var(--muted);
}

.preference-form {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 22px;
  padding-top: 18px;
}

.flash-stack {
  display: grid;
  gap: 10px;
}

.flash {
  border-radius: 6px;
  display: none;
  padding: 12px 14px;
}

.flash-ok {
  background: #e9f7ef;
  color: var(--ok);
}

.flash-error {
  background: #fdecec;
  color: var(--danger);
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 24px;
}

.metric {
  display: grid;
  gap: 8px;
  padding: 22px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  font-size: 24px;
}

.metric small {
  color: var(--muted);
  font-size: 12px;
}

table {
  border-collapse: collapse;
  width: 100%;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.monitor-table th {
  width: auto;
}

.agent-table {
  table-layout: fixed;
}

.agent-table th,
.agent-table td {
  overflow-wrap: anywhere;
  padding-right: 14px;
  vertical-align: top;
}

.agent-table th:nth-child(1) {
  width: 14%;
}

.agent-table th:nth-child(2) {
  width: 11%;
}

.agent-table th:nth-child(3) {
  width: 11%;
}

.agent-table th:nth-child(4) {
  width: 16%;
}

.agent-table th:nth-child(5) {
  width: 9%;
}

.agent-table th:nth-child(6) {
  width: 9%;
}

.agent-table th:nth-child(7) {
  width: 10%;
}

.agent-table th:nth-child(8) {
  width: 8%;
}

.agent-table th:nth-child(9) {
  width: 6%;
}

.agent-table th:nth-child(10) {
  width: 8%;
}

.monitor-table td {
  vertical-align: top;
}

.monitor-table a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.monitor-list {
  display: grid;
  gap: 16px;
}

.monitor-card,
.proxy-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 16px;
  padding: 18px;
}

.proxy-list {
  display: grid;
  gap: 16px;
}

.definition-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.definition-grid div {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-width: 0;
  padding: 10px;
}

.definition-grid dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.definition-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.monitor-card-head {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
}

.monitor-card-status {
  align-items: stretch;
  display: grid;
  gap: 8px;
  min-height: 72px;
  min-width: 96px;
}

.monitor-card-status .status-pill {
  justify-self: end;
  text-align: center;
}

.monitor-card-status .delete-monitor-form {
  justify-self: end;
  margin-left: 0;
}

.monitor-title {
  display: grid;
  flex: 1 1 260px;
  gap: 4px;
  min-width: 0;
}

.monitor-title strong,
.monitor-title a,
.monitor-meta strong {
  overflow-wrap: anywhere;
}

.monitor-title a {
  color: var(--accent);
  font-size: 13px;
}

.monitor-title span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.health-score-summary {
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  display: grid;
  flex: 0 1 230px;
  gap: 6px;
  min-width: 190px;
  padding: 8px 10px;
}

.health-score-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.health-score-summary strong {
  color: #1d4ed8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.25;
}

.health-score-summary dl {
  display: grid;
  gap: 3px;
  margin: 0;
}

.health-score-summary div {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.health-score-summary dt,
.health-score-summary dd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  margin: 0;
}

.health-score-summary dt {
  color: var(--text);
}

.health-score-summary dd {
  color: #1d4ed8;
  font-weight: 700;
}

.health-score-warning {
  background: #fff9db;
  border-color: #eedb86;
}

.health-score-critical {
  background: #fdecec;
  border-color: #f2b8b5;
}

.endpoint-summary,
.certificate-summary {
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  display: grid;
  flex: 0 1 210px;
  gap: 3px;
  min-width: 170px;
  padding: 8px 10px;
}

.endpoint-summary {
  flex-basis: 250px;
}

.endpoint-summary dl {
  display: grid;
  gap: 3px;
  margin: 0;
}

.endpoint-summary div {
  display: grid;
  gap: 8px;
  grid-template-columns: 70px minmax(0, 1fr);
}

.endpoint-summary dt,
.certificate-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.endpoint-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.endpoint-summary dd {
  font-size: 12px;
  font-weight: 700;
  margin: 0;
  overflow-wrap: anywhere;
}

.certificate-summary strong {
  font-size: 14px;
  line-height: 1.25;
}

.endpoint-summary small,
.certificate-summary small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.certificate-summary-alert {
  background: #fdecec;
  border-color: #f2b8b5;
  color: var(--danger);
}

.certificate-summary-alert span,
.certificate-summary-alert small {
  color: var(--danger);
}

.certificate-summary-muted {
  color: var(--muted);
}

.monitor-metrics {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-tile {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px;
}

.metric-tile span,
.monitor-meta span {
  color: var(--muted);
  font-size: 12px;
}

.metric-tile strong {
  font-size: 20px;
}

.metric-chart {
  display: block;
  height: 62px;
  overflow: visible;
  width: 100%;
}

.metric-chart line {
  stroke: #d7dee6;
  stroke-width: 1;
}

.metric-chart polyline {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.metric-chart-empty {
  align-items: center;
  background: #eef3f7;
  border-radius: 6px;
  color: var(--muted);
  display: grid;
  font-size: 12px;
  justify-content: center;
  line-height: 1.4;
  min-height: 62px;
  padding: 8px;
  text-align: center;
}

.metric-chart-empty strong {
  color: #344554;
  font-size: 13px;
}

.metric-chart-empty small {
  color: var(--muted);
  font-size: 12px;
}

.monitor-meta {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.monitor-meta div {
  display: grid;
  gap: 3px;
}

.verify-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 6px;
  margin-top: 10px;
  max-width: 440px;
  padding: 10px;
}

.verify-box span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

code {
  background: #eef3f7;
  border-radius: 4px;
  color: #344554;
  display: inline-block;
  font-size: 12px;
  padding: 3px 5px;
  overflow-wrap: anywhere;
}

.config-block {
  background: #17212b;
  border-radius: 6px;
  margin: 0;
  overflow-x: auto;
  padding: 14px;
}

.config-block code {
  background: transparent;
  color: #e9f7ef;
  display: block;
  font-size: 13px;
  line-height: 1.5;
  padding: 0;
  white-space: pre;
}

.error-note {
  background: #fdecec;
  border-radius: 6px;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  padding: 10px;
}

.status-pill {
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
}

.status-pending,
.status-requested,
.status-contacting,
.status-contracting,
.status-issued,
.status-rotating {
  background: #fff7e6;
  color: #8a5a00;
}

.status-verified,
.status-contracted,
.status-connected,
.status-available,
.status-active {
  background: #e9f7ef;
  color: var(--ok);
}

.status-failed,
.status-rejected,
.status-cancelled,
.status-unavailable,
.status-disabled {
  background: #fdecec;
  color: var(--danger);
}

.status-unknown {
  background: #eef3f7;
  color: var(--muted);
}

.actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions-cell button {
  min-height: 34px;
  padding: 7px 10px;
}

.actions-cell form {
  margin: 0;
}

.delete-monitor-form {
  margin-left: auto;
}

.monitor-primary-actions {
  justify-content: flex-start;
}

.danger-panel {
  border-color: #f2b8b5;
}

.delete-account-form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.confirm-check {
  align-items: center;
  display: flex;
  gap: 8px;
}

.consent-check {
  align-items: flex-start;
  display: flex;
  gap: 8px;
  line-height: 1.5;
}

.registration-confirmations {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.confirmation-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  margin: 0;
}

.confirm-check input,
.consent-check input {
  min-height: auto;
  margin-top: 2px;
}

.confirm-check span,
.consent-check span {
  color: var(--text);
}

.empty-cell {
  color: var(--muted);
}

.step-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.step-list span {
  background: #eef3f7;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #344554;
  padding: 8px 12px;
}

@media (max-width: 760px) {
  .app-header,
  .dashboard-head,
  .section-head,
  .monitor-card-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-panel,
  .grid,
  .inline-form,
  .password-form,
  .pro-upgrade-form,
  .agent-form,
  .request-summary,
  .definition-grid,
  .monitor-metrics,
  .monitor-meta {
    grid-template-columns: 1fr;
  }

  .app-header {
    padding: 16px 20px;
  }

  .app-main {
    padding: 24px 14px 44px;
  }

  .panel {
    padding: 18px;
  }

  .endpoint-summary,
  .health-score-summary,
  .certificate-summary {
    flex-basis: auto;
    min-width: 0;
    width: 100%;
  }

  button,
  .actions-cell form,
  .actions-cell button,
  .preference-form button {
    width: 100%;
  }

  .icon-toggle {
    width: 34px;
  }

  .delete-monitor-form {
    margin-left: 0;
  }

  .dashboard-head form {
    width: 100%;
  }

  .refresh-note {
    white-space: normal;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  nav {
    flex-wrap: wrap;
  }
}
