:root {
  color-scheme: dark;
  font-family: "Inter", "Hiragino Sans", Meiryo, system-ui, sans-serif;
  --background: #0d111b;
  --surface: #151b28;
  --border: #2a3447;
  --text: #f0f3fa;
  --muted: #a9b5ca;
  --accent: #a6afff;
  --accent-surface: #232b4d;
  color: var(--text);
  background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; min-height: 100svh; }
h1 { margin: 0; font-size: clamp(24px, 4vw, 34px); line-height: 1.3; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #5b66aa;
  border-radius: 9px;
  background: var(--accent-surface);
}

.brand-mark::before {
  content: "";
  width: 11px;
  height: 11px;
  border: 2px solid var(--accent);
  border-radius: 3px;
  transform: rotate(45deg);
}

.login-shell {
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 0%, #1d2440, var(--background) 58%);
}

.login-panel {
  width: min(100%, 420px);
  padding: clamp(24px, 6vw, 40px);
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 20px 64px #0005;
}

.login-panel h1 { margin: 28px 0 24px; }
.login-form { display: grid; gap: 18px; }
.login-form label { display: grid; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 600; }

.login-form input,
.login-form button {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 16px;
}

.login-form input { color: var(--text); background: var(--background); }
.login-form button { background: var(--accent); color: #151933; border-color: transparent; font-weight: 700; }
.login-form button:hover { background: #c1c7ff; }
.error { margin: 0; padding: 12px; border-radius: 8px; background: #40232e; color: #ffc6d1; line-height: 1.6; }

.dashboard-shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  padding: 12px clamp(16px, 4vw, 32px);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.account, .account-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account { max-width: 100%; }
.account-name { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--accent);
  background: var(--accent-surface);
  border-radius: 50%;
  font-weight: 700;
}

.secondary-button {
  white-space: nowrap;
  min-height: 36px;
  padding: 7px 11px;
  color: var(--text);
  background: transparent;
  border: 1px solid #495674;
  border-radius: 8px;
  font-size: 13px;
}

.secondary-button:hover { background: var(--accent-surface); }

.sidebar {
  padding: 24px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.nav-current {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border-radius: 8px;
  background: var(--accent-surface);
  color: #dce0ff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.nav-current:hover { background: #2e3862; }

.grid-icon {
  flex: none;
  display: block;
  width: 5px;
  height: 5px;
  margin: 0 8px 8px 0;
  border-radius: 1px;
  background: currentColor;
  box-shadow: 8px 0 currentColor, 0 8px currentColor, 8px 8px currentColor;
}

.workspace { width: min(100%, 1264px); padding: clamp(24px, 4.5vw, 60px); }

.dashboard-content {
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.dashboard-content h2 { margin: 0; padding: 20px clamp(12px, 3vw, 24px); font-size: 18px; }
.status-message { margin: 0; padding: 0 24px 24px; color: var(--muted); }
.server-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 14px; }
.server-table th, .server-table td {
  padding: 12px clamp(8px, 2vw, 20px);
  border-top: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}
.server-table thead { background: var(--background); }
.server-table thead th { color: var(--muted); font-weight: 600; }
.server-table thead th:first-child { width: 34%; }
.server-table thead th:nth-child(2) { width: 24%; }
.server-table td { white-space: pre-wrap; }
.status-dot {
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  margin-right: 0.5em;
  border-radius: 50%;
  background: #8993a5;
}
.status-dot.status-up { background: #4ade80; }
.server-link { display: flex; align-items: baseline; gap: 6px; color: var(--accent); text-decoration: none; }
.server-link:hover { text-decoration: underline; }
.server-details td { background: var(--background); white-space: normal; }
.server-details dl { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 0; }
.server-details dl div { min-width: 0; }
.server-details dt { margin-bottom: 4px; font-size: 12px; }
.server-details dd { margin: 0; white-space: pre-wrap; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 700px) {
  .dashboard-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
  }

  .sidebar { padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav-current { width: fit-content; }
}
