:root {
  --nav: #172033;
  --nav-text: #d5ddec;
  --nav-muted: #93a0b8;
  --accent: #2f6fed;
  --accent-dark: #1f56c4;
  --bg: #eef1f6;
  --card: #ffffff;
  --text: #1c2434;
  --muted: #5c6b82;
  --line: #e3e8f0;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --ok: #067647;
  --ok-bg: #e7f6ee;
  --shadow: 0 8px 24px rgba(23, 32, 51, 0.06);
  --radius: 12px;
  font-family: "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  min-height: 100vh;
}

a { color: var(--accent); }

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

h1 { font-size: 1.25rem; font-weight: 600; }

h2 { font-size: 1rem; margin-bottom: 0.4rem; }

.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--nav);
  color: var(--nav-text);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 22px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav-label {
  margin: 16px 10px 4px;
  color: var(--nav-muted);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-link {
  color: var(--nav-text);
  text-decoration: none;
  border-radius: 8px;
  padding: 9px 10px;
}

.nav-link:hover { background: rgba(255, 255, 255, 0.06); }

.nav-link.is-active { background: var(--accent); color: white; }

.sidebar-foot {
  margin-top: auto;
  color: var(--nav-muted);
  font-size: 0.85rem;
  padding: 10px;
}

.workspace { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
}

.topbar h1 { margin: 0; }

.userbox {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.who {
  color: var(--muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

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

.content { padding: 24px; }

.lede { color: var(--muted); max-width: 62ch; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.card-link, .panel, .login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-link {
  display: block;
  padding: 18px;
  text-decoration: none;
  color: inherit;
}

.card-link p { color: var(--muted); margin: 0; }

.card-link:hover { border-color: var(--accent); }

.panel { padding: 18px; margin-bottom: 16px; }

.empty {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 22px;
  background: #f8fafc;
}

.empty h2 { margin-bottom: 6px; }

.login-body {
  background:
    radial-gradient(circle at top left, rgba(47, 111, 237, 0.16), transparent 32%),
    var(--bg);
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  gap: 18px;
}

.brand-on-light { color: var(--text); margin: 0; }

.login-card { width: min(420px, 100%); padding: 28px 24px; }

.login-card h1 { margin-bottom: 6px; }

label, .label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 14px 0 6px;
}

input, select {
  width: 100%;
  border: 1px solid #cfd6e4;
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: white;
  color: var(--text);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  margin: 14px 0;
}

.check input { width: auto; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  padding: 10px 14px;
  cursor: pointer;
}

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

.button-quiet {
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}

.button-quiet:hover { background: #f4f7fb; }

form .button { margin-top: 16px; }

.banner {
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 12px;
}

.banner-bad { background: var(--danger-bg); color: var(--danger); }

.banner-ok { background: var(--ok-bg); color: var(--ok); }

.field-error { color: var(--danger); font-size: 0.85rem; }

.validation-summary-valid { display: none; }

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

.secret, .uri code, pre {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  background: #f4f7fb;
  border-radius: 8px;
  padding: 10px 12px;
}

.secret { letter-spacing: 0.04em; }

.uri code {
  display: block;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

pre {
  display: block;
  min-width: 18rem;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.codes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  padding: 0;
  list-style: none;
}

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

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

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

th {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.nowrap { white-space: nowrap; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px 14px;
  align-items: end;
}

.form-actions { display: flex; align-items: end; }

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

.inline-form select { width: auto; min-width: 130px; }

.inline-form .button { margin-top: 0; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { padding-bottom: 10px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot, .nav-label { display: none; }
  .brand { margin-bottom: 10px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .content { padding: 16px; }
}
