:root {
  --bg: #0f172a;
  --panel: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-ink: #1d4ed8;
  --ok: #16a34a;
  --warn: #b45309;
  --danger: #dc2626;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: #f1f5f9;
}
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 24px;
  background: var(--bg); color: #e2e8f0;
  padding: 0 24px; height: 56px;
}
.topbar .brand { font-weight: 700; letter-spacing: .3px; }
.topbar nav { display: flex; gap: 18px; margin-right: auto; }
.topbar nav a { color: #cbd5e1; padding: 4px 2px; }
.topbar nav a:hover { color: #fff; text-decoration: none; }
.topbar nav a.active { color: #fff; border-bottom: 2px solid var(--brand); }

/* Top-nav dropdown (Servers ▾) */
.nav-dd { position: relative; display: inline-block; }
.nav-dd > a::after { content: " ▾"; font-size: 11px; }
.nav-dd-menu {
  display: none; position: absolute; top: 100%; left: -10px; z-index: 30;
  min-width: 170px; padding: 6px 0; background: #1e293b;
  border: 1px solid #334155; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.nav-dd:hover .nav-dd-menu, .nav-dd:focus-within .nav-dd-menu { display: block; }
.nav-dd-menu a { display: block; padding: 8px 14px; color: #cbd5e1; }
.nav-dd-menu a:hover { background: #334155; color: #fff; text-decoration: none; }
.nav-dd-menu a.active { border-bottom: none; color: #fff; }
.logout { margin: 0; }
button.link {
  background: none; border: 0; color: #cbd5e1; cursor: pointer; font: inherit;
}
button.link:hover { color: #fff; }

main { max-width: 960px; margin: 32px auto; padding: 0 24px; }
main.centered {
  min-height: calc(100vh - 64px); display: flex; align-items: center;
  justify-content: center; flex-direction: column; max-width: 420px;
}

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 24px 0 8px; }
.subtitle { color: var(--muted); margin: 0 0 20px; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; width: 100%;
}
.card + .card { margin-top: 18px; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat .n { font-size: 30px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; }

label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 4px; }
input[type=text], input[type=password], textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.check input { width: auto; }
.check label { margin: 0; }

.btn {
  display: inline-block; background: var(--brand); color: #fff; border: 0;
  padding: 9px 16px; border-radius: 8px; font: inherit; font-weight: 600;
  cursor: pointer; margin-top: 18px;
}
.btn:hover { background: var(--brand-ink); text-decoration: none; color: #fff; }
.btn.secondary { background: #e2e8f0; color: var(--ink); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); padding: 5px 10px; margin: 0; font-size: 13px; }
.btn.small { padding: 6px 12px; margin: 0; font-size: 13px; }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; }

table { width: 100%; border-collapse: collapse; margin-top: 6px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.ok { background: #dcfce7; color: var(--ok); }
.pill.off { background: #fee2e2; color: var(--danger); }
.pill.svc { background: #ede9fe; color: #6d28d9; }
.pill.revoked { background: #f1f5f9; color: var(--muted); }
.pill.warn { background: #fef3c7; color: #92400e; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

.alert { padding: 11px 14px; border-radius: 8px; margin: 0 0 16px; font-size: 14px; }
.alert.err { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert.ok { background: #f0fdf4; color: var(--ok); border: 1px solid #bbf7d0; }
.alert.warn { background: #fffbeb; color: var(--warn); border: 1px solid #fde68a; }

/* Section tabs inside a detail page (see portal/machines/show.hbs). Keeps a
   page navigable as sections are added, instead of one ever-growing scroll. */
.tabs {
  display: flex; flex-wrap: wrap; gap: 2px;
  border-bottom: 1px solid var(--line); margin: 0 0 18px;
}
.tabs button {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent;
  border-radius: 0; margin: 0; padding: 9px 14px; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--muted);
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--brand-ink); border-bottom-color: var(--brand); }
/* Count badge on a tab (e.g. "Shares 2") — a bare .pill has no fill. */
.tabs button .pill { margin-left: 7px; vertical-align: 1px; background: #e2e8f0; color: var(--muted); }
.tabs button[aria-selected="true"] .pill { background: #dbeafe; color: var(--brand-ink); }
/* The first card in a panel sits directly under the tab strip. */
.tabpanel > .card:first-child { margin-top: 0; }

.keybox {
  background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 8px;
  word-break: break-all; margin-top: 8px; display: flex; gap: 10px; align-items: center;
}
.keybox code { color: #bae6fd; flex: 1; }
.codeblock {
  background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 8px;
  margin-top: 8px; overflow-x: auto; font-size: 13px; line-height: 1.5;
  white-space: pre; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.muted { color: var(--muted); }
.right { text-align: right; }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.mt0 { margin-top: 0; }
