/* Shared chrome for the consoles. No framework and no build step: the site is
   served as static files, and adding a toolchain for four pages would cost more
   than it saves.

   The tokens, type and component shapes are the marketing site's
   (semper-website/css/style.css) so that sempermechanics.com → /login is one
   product, not two. Copy a value from there rather than inventing one here. */
:root {
  color-scheme: dark;
  --bg: #0c0f14;
  --bg-elevated: #141a24;
  --card: #1a2230;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.2);
  --ink: #eef1f6;
  --muted: #a8b2c1;
  --accent: #d4a054;
  --accent-dim: rgba(212, 160, 84, 0.15);
  --accent-hover: #e4b46a;
  --danger: #f2b8b5;
  --warn: #e3b341;
  --ok: #7ee2a8;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Plus Jakarta Sans", var(--font);
  --radius: 12px;
  --max-width: 1120px;
}
* { box-sizing: border-box; }
/* Author display rules (.pill, .row …) would otherwise beat the UA's hidden. */
[hidden] { display: none !important; }
html { font-size: 16px; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: .95rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

/* Header: the site's fixed bar, unfixed — a console is a working surface and
   a sticky 4 rem strip over a licence table is 4 rem of table you cannot see. */
header {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 0 1.5rem; min-height: 4rem;
  background: rgba(12, 15, 20, 0.85); border-bottom: 1px solid var(--line);
}
header h1 {
  font-family: var(--font-display); font-size: 1rem; font-weight: 600;
  margin: 0; padding-left: 1rem; border-left: 1px solid var(--line); line-height: 1.7rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-display); font-weight: 700; font-size: 1.25rem;
  letter-spacing: -.03em; color: var(--ink);
}
.brand:hover { color: var(--ink); }
.brand img { width: 1.7rem; height: 1.7rem; border-radius: 6px; display: block; }
.spacer { flex: 1; }
main { flex: 1; width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 2rem 1.5rem; }

footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 1rem; max-width: var(--max-width); width: 100%; margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem; border-top: 1px solid var(--line);
  font-size: .85rem; color: var(--muted);
}
footer nav { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; }
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; margin-bottom: 1.25rem;
}
h2 {
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 700;
  letter-spacing: -.01em; margin: 0 0 .75rem;
}
p { margin: .5rem 0; }
.muted { color: var(--muted); font-size: .9rem; }

/* Buttons are the site's .btn-primary / .btn-secondary at console density. */
button {
  font: inherit; font-weight: 600; font-size: .9rem;
  padding: .55rem 1rem; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--bg);
  transition: background .2s, border-color .2s, color .2s;
}
button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.secondary { background: transparent; border-color: var(--line-strong); color: var(--ink); }
button.secondary:hover { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.35); }
button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
button.danger:hover { background: rgba(242, 184, 181, 0.08); }
button[disabled] { opacity: .5; cursor: not-allowed; }
input, select {
  font: inherit; padding: .55rem .7rem; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--bg-elevated); color: var(--ink);
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
input:disabled, select:disabled { opacity: .5; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
td.actions { text-align: right; white-space: nowrap; }
.pill {
  display: inline-block; padding: .1rem .6rem; border-radius: 999px;
  font-size: .78rem; font-weight: 500; border: 1px solid var(--line-strong);
}
.pill.ok { color: var(--ok); border-color: currentColor; }
.pill.warn { color: var(--warn); border-color: currentColor; }
.pill.off { color: var(--muted); }
.note {
  border-left: 3px solid var(--accent); padding: .6rem .9rem; margin: .75rem 0;
  background: var(--accent-dim); border-radius: 0 8px 8px 0;
}
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.err { color: var(--danger); }

/* The status line sits above the first card, and the licence table is well
   below it: a result written there while the operator worked in the table was
   off-screen. Pinned while it says something; empty, it takes no room. */
#status:not(:empty) {
  position: sticky; top: .5rem; z-index: 5;
  background: var(--bg-elevated); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: .6rem 1rem;
}
#status.err:not(:empty) { border-color: currentColor; }
.ok { color: var(--ok); }
.wrap { overflow-x: auto; }

/* Forms. The mint form is the only dense one, so the grid is defined once
   here rather than per page: two columns where there is room, one where a
   phone would otherwise squeeze the labels into an unreadable column. */
.grid {
  display: grid; gap: .75rem 1rem; margin: .75rem 0;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}
.grid label, .row label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; }
.grid label.wide { grid-column: 1 / -1; }
.row label { flex-direction: row; align-items: center; gap: .35rem; }
.grid label.check { flex-direction: row; align-items: center; gap: .35rem; align-self: end; }

/* The licence Edit and Convert dialogs: a card over a dimmed desk. */
dialog {
  width: min(40rem, calc(100% - 2rem)); max-height: calc(100vh - 2rem); overflow: auto;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 1.5rem;
}
dialog::backdrop { background: rgba(0, 0, 0, .55); }

/* The TOTP QR code. White behind it whatever the theme: a scanner wants
   dark modules on a light ground, and 11rem is large enough for a phone
   held at arm's length from a laptop screen. */
.qr { margin: .75rem 0; }
.qr svg { display: block; width: 11rem; height: 11rem; border-radius: 8px; background: #fff; }
.enrol details { margin: .5rem 0 .75rem; }
.enrol summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.enrol summary:hover { color: var(--accent); }
.enrol .key { margin: .6rem 0 .25rem; }

/* Keys, secrets and device ids: fixed width so a transposed character is
   visible, and selectable in one gesture because both are meant to be copied. */
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
}
.key {
  user-select: all; font-size: 1.05rem; letter-spacing: .04em;
  padding: .5rem .6rem; border-radius: 8px; background: var(--bg-elevated);
  border: 1px solid var(--line-strong); display: inline-block; word-break: break-all;
}

@media (max-width: 640px) {
  header { padding: .75rem 1rem; }
  header h1 { padding-left: 0; border-left: 0; flex-basis: 100%; line-height: 1.3; }
  main { padding: 1.25rem 1rem; }
  footer { padding: 1rem; }
}
