:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1a1d26;
  --muted: #5c6473;
  --border: #e2e6ef;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Georgia", "Times New Roman", serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.top {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow);
}

.brand .logo {
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 1.1rem;
}

.brand .sub {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.nav button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
}

.nav button:hover {
  border-color: #c7d2fe;
  color: var(--accent);
}

.nav a.nav-link {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: none;
}

.nav a.nav-link:hover {
  border-color: #c7d2fe;
  color: var(--accent);
}

.nav a.nav-link.active {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--accent);
}

.nav button.active {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--accent);
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

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

.login-link {
  color: var(--accent);
  text-decoration: none;
}

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

button.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

textarea.readonly-user {
  opacity: 0.92;
  background: #f1f5f9 !important;
}

.callout {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.callout.warn {
  background: #fffbeb;
  border-color: #fcd34d;
}

.inline-pre {
  display: inline-block;
  vertical-align: middle;
  margin: 0.35rem 0.5rem 0.35rem 0;
  padding: 0.35rem 0.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
}

button.small {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.steps {
  margin: 0 0 1rem 1.1rem;
  color: var(--text);
}

.text-in {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  background: #fafbff;
}

.hint-inline {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.85rem;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 0.75rem 0 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.guide-table th,
.guide-table td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.guide-table thead {
  background: #f1f5f9;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.provider-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  background: #fafbff;
}

.provider-card h4 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.provider-card .tiny {
  font-size: 0.8rem;
  margin: 0 0 0.5rem;
}

.effective-base {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 0.65rem;
  word-break: break-all;
}

.effective-base code {
  font-size: 0.78rem;
}

.callout.calm {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.status-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #f8fafc;
}

.status-lamp {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-top: 0.2rem;
  flex-shrink: 0;
  background: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.35);
}

.status-lamp.ok {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35);
}

.status-lamp.bad {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.35);
}

.status-checks {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
}

.status-checks li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.ssh-step {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.ssh-step h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.ssh-block {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-all;
  background: #fff;
  border: 1px solid var(--border);
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  margin: 0.35rem 0;
}

.help-copy {
  font-size: 0.82rem;
  margin-top: 0.35rem;
}

.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 1rem 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0.75rem 0 0.35rem;
}

textarea {
  width: 100%;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.82rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fafbff;
  color: var(--text);
  resize: vertical;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

button {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button.danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--danger);
}

.preview {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 420px;
  overflow: auto;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.65rem 1rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  z-index: 50;
}

.toast.err {
  border-color: #fecaca;
  color: var(--danger);
}

code {
  font-size: 0.85em;
  background: #eef2ff;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

@media (max-width: 640px) {
  .top {
    flex-direction: column;
    align-items: flex-start;
  }
}
