:root {
  --bg: #0d0f13;
  --surface: #161a21;
  --surface-hover: #1d222b;
  --border: #262c37;
  --text: #e8ebf0;
  --muted: #8b93a1;
  --accent: #4ade80;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f8; --surface: #fff; --surface-hover: #f0f2f5; --border: #dde1e8;
    --text: #14181f; --muted: #667085; --accent: #16a34a; --danger: #dc2626; --warn: #b45309;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
h1, h2 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 20px; }
h1 span { color: var(--accent); }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

/* buttons & inputs */
.btn {
  font: inherit; font-weight: 550; border-radius: 8px; padding: 9px 16px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.btn:hover { background: var(--surface-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #07240f; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:focus-visible, input:focus-visible, .tool:focus-visible, .site:focus-visible, .dock-bar:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input {
  font: inherit; width: 100%; margin-top: 6px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; padding: 32px; display: grid; gap: 16px; }
.login-card label { font-size: 13px; color: var(--muted); }
.error { color: var(--danger); font-size: 13px; min-height: 1.4em; margin: 0; }

/* portal */
.portal { min-height: 100vh; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.content { max-width: 1100px; margin: 0 auto; padding: 24px; display: grid; gap: 32px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }

.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.tool {
  display: grid; gap: 4px; align-content: start; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
a.tool:hover { background: var(--surface-hover); border-color: var(--accent); }
.tool-title { font-weight: 650; font-size: 16px; }
.tool-ssh { grid-template-columns: 1fr auto; align-items: center; }
.tool-ssh .tool-title { grid-column: 1 / -1; }
.tool-ssh code { overflow-wrap: anywhere; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.grid.compact { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.site {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.site:hover { background: var(--surface-hover); }
.site .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.site .dot.up { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.site .dot.down { background: var(--danger); }
.site-text { min-width: 0; display: grid; }
.site-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-host { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact .site { padding: 8px 12px; opacity: .8; }

/* animations: normal flow, below everything else */
.dock {
  width: min(560px, calc(100% - 48px)); margin: 8px auto 32px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.dock-bar {
  width: 100%; display: flex; justify-content: space-between; padding: 8px 14px;
  font: inherit; font-size: 12px; text-transform: uppercase; letter-spacing: .08em;
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
}
.dock-body { display: flex; gap: 8px; padding: 0 8px 8px; }
.dock-body img { flex: 1 1 0; min-width: 0; width: 50%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--bg); }
.dock.collapsed .dock-body { display: none; }
@media (max-width: 560px) {
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .dock { width: calc(100% - 32px); }
}
