:root { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, Inter, sans-serif;
  background: #0b0c10;
  color: #e9ecf1;
  line-height: 1.45;
}
a { color: #7cc4ff; text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: .8rem 1.2rem; border-bottom: 1px solid #1c2230; background: #11141c;
}
.topbar .brand { font-weight: 700; color: #fff; }
.topbar nav a, .topbar nav .link { margin-left: 1.1rem; color: #c8d2e0; background: none; border: 0; cursor: pointer; font: inherit; }
main { max-width: 1100px; margin: 0 auto; padding: 1.4rem; }
h1 { margin: 0 0 .8rem; font-size: 1.7rem; }
h3 { margin-top: 0; }
.row { display: flex; align-items: center; gap: 1rem; }
.row.between { justify-content: space-between; }
.muted { color: #8893a5; }
.err { background: #3a1418; color: #ffb4ba; padding: .6rem .8rem; border-radius: 6px; }
form label { display: block; margin: .5rem 0; }
input, select, button {
  width: 100%; padding: .5rem .6rem; border-radius: 6px;
  border: 1px solid #2a3142; background: #161a23; color: inherit; font: inherit;
}
button { background: #2563eb; border-color: #2563eb; cursor: pointer; }
button:hover { background: #1d4fd6; }
button.danger { background: #b91c1c; border-color: #b91c1c; }
button.link { background: none; border: 0; padding: 0; color: #c8d2e0; }
.btn { display: inline-block; background: #2563eb; color: #fff; padding: .45rem .8rem; border-radius: 6px; }
.card { background: #11141c; border: 1px solid #1c2230; padding: 1rem 1.2rem; border-radius: 10px; margin: 1rem 0; }
.card.narrow { max-width: 360px; margin: 4rem auto; }
.card.danger { border-color: #5c1e1e; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 1rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem; border-bottom: 1px solid #1c2230; }
.sites tr:hover { background: #141926; }
.status {
  display: inline-block; padding: .15rem .55rem; border-radius: 999px;
  font-size: .78rem; background: #1c2230; color: #c8d2e0;
}
.status.running, .status.success { background: #14361f; color: #87e7a2; }
.status.errored, .status.failed { background: #3a1418; color: #ffb4ba; }
.status.creating, .status.pending { background: #2a2918; color: #f2e497; }
.status.maint { background: #2d1d3a; color: #d6b2ff; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.logbox {
  max-height: 480px; overflow: auto; background: #07080c; padding: .8rem;
  border-radius: 6px; font-family: ui-monospace, monospace; font-size: .82rem;
  white-space: pre-wrap;
}
.inline { display: inline; }
code { background: #161a23; padding: 1px 5px; border-radius: 4px; }

/* ---- Site detail layout ---- */
.site-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.2rem; background: #11141c; border: 1px solid #1c2230;
  border-radius: 10px; margin-bottom: 1rem; gap: 1rem; flex-wrap: wrap;
}
.site-actions { display: flex; gap: .4rem; }
.site-actions form { margin: 0; }
.site-actions button { min-width: 8.5rem; width: auto; }

.site-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.2rem;
  align-items: start;
}
.site-sidebar {
  position: sticky; top: 1rem;
  display: flex; flex-direction: column; gap: 2px;
  background: #11141c; border: 1px solid #1c2230;
  border-radius: 10px; padding: .4rem;
}
.site-sidebar a {
  display: block; padding: .5rem .8rem; color: #c8d2e0;
  border-radius: 6px; text-decoration: none; font-size: .92rem;
}
.site-sidebar a:hover { background: #161a23; }
.site-sidebar a.active { background: #1c2230; color: #fff; font-weight: 600; }

.site-tab .card:first-child { margin-top: 0; }

@media (max-width: 800px) {
  .site-shell { grid-template-columns: 1fr; }
  .site-sidebar {
    position: static; flex-direction: row; overflow-x: auto; padding: .3rem;
  }
  .site-sidebar a { flex: 0 0 auto; }
}
