:root {
  color-scheme: light;
  --primary: #7c3aed;
  --primary-dark: #5b21b6;
  --primary-soft: #f3e8ff;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --ink: #18181b;
  --muted: #71717a;
  --line: #e4e4e7;
  --surface: #ffffff;
  --canvas: #f8f7fb;
  --shadow: 0 16px 40px rgb(24 24 27 / 8%);
  font-family: Inter, "Noto Sans JP", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 80% 0%, #ede9fe 0, transparent 28rem),
    var(--canvas);
  min-height: 100vh;
}

.topbar {
  height: 72px;
  padding: 0 max(24px, calc((100vw - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgb(228 228 231 / 80%);
  background: rgb(255 255 255 / 82%);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
}

.environment,
.mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
}

.environment {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid #ddd6fe;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.text-button {
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.text-button:hover {
  color: var(--ink);
}

.text-button:focus-visible,
input:focus-visible {
  outline: 3px solid rgb(124 58 237 / 35%);
  outline-offset: 3px;
}

main {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 64px 0 80px;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
}

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

h1 {
  max-width: 660px;
  margin-bottom: 16px;
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.lead {
  max-width: 640px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.status-card {
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(255 255 255 / 78%);
  box-shadow: var(--shadow);
}

.status-dot {
  width: 12px;
  height: 12px;
  flex: none;
  border-radius: 999px;
  background: var(--warning);
  box-shadow: 0 0 0 5px rgb(217 119 6 / 12%);
}

.status-card.connected .status-dot {
  background: var(--success);
  box-shadow: 0 0 0 5px rgb(5 150 105 / 12%);
}

.status-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 36px 0 24px;
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:focus-visible {
  outline: 3px solid rgb(124 58 237 / 35%);
  outline-offset: 3px;
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary {
  color: white;
  background: var(--primary);
  box-shadow: 0 8px 20px rgb(124 58 237 / 22%);
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface);
}

.message {
  margin-bottom: 24px;
  padding: 14px 16px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: #9a3412;
  background: #fff7ed;
  font-size: 14px;
}

.message[data-type="success"] {
  border-color: #a7f3d0;
  color: #065f46;
  background: #ecfdf5;
}

.message[data-type="error"] {
  border-color: #fecaca;
  color: #991b1b;
  background: #fef2f2;
}

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

.login-shell {
  width: min(100%, 460px);
  padding: 0;
}

.login-card {
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(255 255 255 / 92%);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin-bottom: 12px;
  font-size: clamp(30px, 8vw, 42px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  font-weight: 750;
}

.login-brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.login-form {
  display: grid;
  gap: 20px;
  margin-top: 28px;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.login-form input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
}

.login-form .button {
  width: 100%;
  min-height: 48px;
}

.login-card .message {
  margin: 20px 0 0;
}

.grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.6fr);
  gap: 20px;
}

.card {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.card h2 {
  margin-bottom: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

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

.metric {
  color: var(--primary);
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}

.details {
  margin: 0;
}

.details div {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.details dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

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

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.empty {
  height: 120px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 760px) {
  .topbar {
    padding-inline: 20px;
  }

  main {
    width: min(100% - 32px, 1120px);
    padding-top: 40px;
  }

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

  .status-card {
    min-width: 0;
  }

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

  .button {
    flex: 1 1 180px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
