:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --text: #20242c;
  --muted: #626c7a;
  --line: #d9dee8;
  --ok: #16845b;
  --slow: #9a6a00;
  --very-slow: #b64f0a;
  --error: #be2f36;
  --unknown: #646b75;
  --shadow: 0 8px 22px rgba(32, 36, 44, 0.08);
}

* {
  box-sizing: border-box;
}

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

main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
}

.intro {
  margin: -4px 0 18px;
  color: var(--muted);
  font-size: 0.94rem;
}

.intro p {
  margin: 0 0 8px;
}

.checked-at {
  color: var(--muted);
  font-size: 0.92rem;
  white-space: nowrap;
}

.summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 6px solid var(--unknown);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary[data-level="OK"] {
  border-left-color: var(--ok);
}

.summary[data-level="SLOW"] {
  border-left-color: var(--slow);
}

.summary[data-level="VERY_SLOW"] {
  border-left-color: var(--very-slow);
}

.summary[data-level="SERVER_ERROR"],
.summary[data-level="TIMEOUT"] {
  border-left-color: var(--error);
}

.summary-message {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
}

.counts {
  display: grid;
  grid-template-columns: repeat(6, minmax(68px, 1fr));
  gap: 8px;
}

.count {
  min-width: 68px;
  padding: 8px 10px;
  background: #f3f5f8;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: center;
}

.count span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.count strong {
  display: block;
  margin-top: 2px;
  font-size: 1.1rem;
}

.history-panel,
.repo-history {
  margin-bottom: 18px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.repo-history-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.range-controls {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  background: #f3f5f8;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.range-button {
  min-width: 54px;
  padding: 6px 9px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 5px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 750;
  cursor: pointer;
}

.range-button[aria-pressed="true"] {
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 1px 4px rgba(32, 36, 44, 0.12);
}

.repo-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.repo-filter label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  white-space: nowrap;
}

.repo-filter-select {
  min-width: 160px;
  padding: 6px 9px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  font-size: 0.82rem;
}

.repo-filter-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chart-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.chart {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
}

.axis,
.grid,
.threshold {
  vector-effect: non-scaling-stroke;
}

.axis {
  stroke: #8a94a3;
}

.grid {
  stroke: #e5e9f0;
}

.threshold {
  stroke-dasharray: 6 5;
}

.chart-label {
  fill: var(--muted);
  font-size: 12px;
}

.chart-empty {
  padding: 34px 16px;
  color: var(--muted);
  text-align: center;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 12px 0 0;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
}

.legend-swatch {
  width: 14px;
  height: 3px;
  border-radius: 999px;
}

.legend-swatch--0 { background: #2a78d6; }
.legend-swatch--1 { background: #eb6834; }
.legend-swatch--2 { background: #1aa674; }
.legend-swatch--3 { background: #c48500; }
.legend-swatch--4 { background: #e46595; }
.legend-swatch--5 { background: #008300; }
.legend-swatch--6 { background: #4a3aa7; }
.legend-swatch--7 { background: #e34948; }
.legend-swatch--fallback { background: #595959; }

.chart-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.history-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.stat {
  padding: 9px 10px;
  background: #f3f5f8;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.stat strong {
  display: block;
  margin-top: 2px;
  font-size: 1rem;
}

.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  background: #f3f5f8;
  font-size: 0.78rem;
  font-weight: 750;
}

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

a {
  color: #1a5fb4;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-width: 92px;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 800;
}

.badge.OK {
  background: var(--ok);
}

.badge.SLOW {
  background: var(--slow);
}

.badge.VERY_SLOW {
  background: var(--very-slow);
}

.badge.SERVER_ERROR,
.badge.TIMEOUT {
  background: var(--error);
}

.badge.UNKNOWN {
  background: var(--unknown);
}

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

.empty {
  padding: 24px;
  color: var(--muted);
}

.site-footer {
  margin-top: 32px;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.site-footer p {
  margin: 4px 0;
}

@media (max-width: 800px) {
  header,
  .summary {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  header {
    flex-direction: column;
  }

  .checked-at {
    white-space: normal;
  }

  .counts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .range-controls {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .range-button {
    min-width: 0;
  }

  .repo-filter {
    flex-wrap: wrap;
  }

  .repo-filter-select {
    flex: 1;
    min-width: 0;
  }

  .history-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Digital Agency Design System inspired service theme */
:root {
  --bg: #f5f8fc;
  --panel: #ffffff;
  --text: #1a1a1a;
  --muted: #4a4a4a;
  --line: #949494;
  --line-light: #d8d8d8;
  --primary: #0017c1;
  --primary-dark: #000082;
  --primary-pale: #e8f1fe;
  --ok: #006e54;
  --slow: #8a5c00;
  --very-slow: #a63c00;
  --error: #b40018;
  --unknown: #595959;
  --focus: #ffd43d;
  --shadow: 0 2px 8px rgba(0, 23, 193, 0.08);
}

body {
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

main {
  padding: 40px 0 56px;
}

header {
  margin-bottom: 24px;
}

h1 {
  padding-left: 16px;
  border-left: 6px solid var(--primary);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  line-height: 1.4;
}

.intro {
  margin: 0 0 32px;
  font-size: 1rem;
}

.checked-at,
.site-footer,
.legend-item {
  font-size: 0.875rem;
}

.summary,
.history-panel,
.repo-history {
  margin-bottom: 32px;
  padding: 24px;
  border-color: var(--line-light);
  border-radius: 12px;
}

.summary {
  border-left-width: 8px;
}

.summary-message {
  font-size: 1.125rem;
  font-weight: 700;
}

.count,
.stat {
  background: var(--bg);
  border-color: var(--line-light);
  border-radius: 8px;
}

.count span,
.stat span {
  font-size: 0.75rem;
}

.panel-head h2,
.repo-history-title {
  padding-left: 12px;
  border-left: 4px solid var(--primary);
  font-size: 1.25rem;
}

.range-controls {
  background: var(--primary-pale);
  border-color: #b5c7f3;
  border-radius: 8px;
}

.range-button {
  min-width: 56px;
  min-height: 40px;
  padding: 8px 12px;
  color: var(--primary-dark);
  font-size: 0.875rem;
}

.range-button:hover {
  background: rgba(0, 23, 193, 0.1);
}

.range-button[aria-pressed="true"] {
  color: #fff;
  background: var(--primary);
  box-shadow: none;
}

.range-button[aria-pressed="true"]:hover {
  background: var(--primary-dark);
}

.repo-filter-select {
  min-height: 40px;
  padding: 8px 12px;
  border-color: var(--line-light);
  font-size: 0.875rem;
}

.repo-filter label {
  font-size: 0.875rem;
}

a:focus-visible,
button:focus-visible,
select:focus-visible {
  outline: 4px solid #000;
  outline-offset: 2px;
  border-radius: 4px;
  box-shadow: 0 0 0 2px var(--focus);
}

.chart-wrap {
  border-color: var(--line-light);
  background: #fff;
}

.table-wrap {
  border-color: var(--line);
}

.recent-errors {
  margin-bottom: 32px;
  padding: 24px;
  background: #fff;
  border: 1px solid #e8a3ad;
  border-left: 8px solid var(--error);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.recent-errors-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  cursor: pointer;
  list-style: none;
}

.recent-errors-summary::-webkit-details-marker {
  display: none;
}

.recent-errors-summary::before {
  content: "\25b6";
  align-self: center;
  font-size: 0.75rem;
  color: var(--error);
  transition: transform 0.15s ease;
}

.recent-errors-details[open] .recent-errors-summary::before {
  transform: rotate(90deg);
}

.recent-errors-summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
  border-radius: 4px;
}

.recent-errors-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
}

.recent-errors-count {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--error);
}

.recent-errors p {
  margin: 16px 0;
  color: var(--muted);
}

.recent-errors .table-wrap {
  box-shadow: none;
}

.recent-errors table {
  min-width: 600px;
}

th,
td {
  padding: 16px;
  border-bottom-color: var(--line-light);
}

th {
  background: var(--primary-pale);
  font-size: 0.875rem;
}

tbody tr:hover {
  background: #f8faff;
}

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:visited {
  color: #5f249f;
}

.badge {
  border: 1px solid currentColor;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge.OK { color: var(--ok); background: #e6f5f0; }
.badge.SLOW { color: var(--slow); background: #fff4bf; }
.badge.VERY_SLOW { color: var(--very-slow); background: #ffeadb; }
.badge.SERVER_ERROR,
.badge.TIMEOUT { color: var(--error); background: #fde7e9; }
.badge.UNKNOWN { color: var(--unknown); background: #eeeeee; }

@media (max-width: 520px) {
  main {
    width: min(100% - 24px, 1120px);
    padding-top: 24px;
  }

  .summary,
  .history-panel,
  .repo-history,
  .recent-errors {
    padding: 16px;
  }

  .counts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
