/* Plain CSS, no framework, no build step. The page is a small amount of
   semantic HTML and this file makes it readable — nothing here is load-bearing
   for correctness, and the portal works without it.

   Both colour schemes are defined because the browser decides, not us. */

:root {
  color-scheme: light dark;
  --bg: #fff;
  --fg: #16181d;
  --muted: #5c6370;
  --line: #d8dce3;
  --panel: #f6f7f9;
  --accent: #1a5fb4;
  --ok: #1a7f37;
  --warn: #9a6700;
  --bad: #b42318;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --fg: #e7e9ee;
    --muted: #9aa1ad;
    --line: #333842;
    --panel: #1e2128;
    --accent: #79b4ff;
    --ok: #4ac26b;
    --warn: #d9a441;
    --bad: #ff7b72;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main { max-width: 52rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 600; text-decoration: none; color: var(--fg); }
.inline { display: flex; align-items: center; gap: 0.75rem; margin: 0; }
.who { color: var(--muted); font-size: 0.9rem; }

h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.15rem; margin: 2.25rem 0 0.75rem; }
h3 { font-size: 1rem; margin: 0 0 0.25rem; font-family: ui-monospace, monospace; }
.sub { margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; align-items: center; }
.muted { color: var(--muted); font-size: 0.9rem; }

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

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.875rem; }

pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem 0.85rem;
  overflow-x: auto;
  /* Long enrollment commands and DNS records must scroll inside the block
     rather than widening the page on a phone. */
  white-space: pre;
}

.note {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 4px;
  padding: 0.7rem 0.9rem;
  margin: 1rem 0;
  background: var(--panel);
}
.note.ok { border-left-color: var(--ok); }
.note.warn { border-left-color: var(--warn); }
.note.bad { border-left-color: var(--bad); }

.badge {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
}
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.bad { color: var(--bad); }
.badge.muted { color: var(--muted); }

.cards { display: grid; gap: 1rem; }

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
}
.card p { margin: 0.5rem 0; }
.card form { margin-top: 0.75rem; }

.tenants { list-style: none; padding: 0; }
.tenants li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
tr.spent td { color: var(--muted); }
td form { margin: 0; }

.stack { display: grid; gap: 1rem; max-width: 34rem; }
label { display: grid; gap: 0.3rem; font-weight: 500; }
label small { font-weight: 400; color: var(--muted); }

input {
  font: inherit;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
  color: var(--fg);
  width: 100%;
}

button, .button {
  font: inherit;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  justify-self: start;
}
button:disabled { opacity: 0.6; cursor: default; }

button.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
button.link { background: none; border: none; color: var(--accent); padding: 0; text-decoration: underline; }

details summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }

footer {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

/* Tenant switcher. Only rendered for somebody who belongs to more than one,
   so most people never see it. */
.switcher {
  max-width: 52rem;
  margin: 0 auto;
  padding: 0.5rem 1rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  align-items: center;
  font-size: 0.9rem;
}
.switcher a, .switcher .current {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.7rem;
  text-decoration: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.switcher .current { border-color: var(--accent); color: var(--fg); font-weight: 600; }
