/* Makroskop's palette, the same tokens the apps use
   (documents/04-design-system.md). Petrol/teal on cream, no gradients. */
:root {
  --ink: #123c43;
  --accent: #2fa7a0;
  --background: #f5f3ee;
  --surface: #ffffff;
  --surface-alt: #edeae1;
  --text: #172326;
  --text-soft: #5c6b6c;
  --border: #e4e1d8;
  --warn: #9a3b2f;
  --ok: #2fa76b;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ddedea;
    --accent: #4fc2b8;
    --background: #0e1a1c;
    --surface: #16292c;
    --surface-alt: #1e3438;
    --text: #eaf2f1;
    --text-soft: #8fa3a3;
    --border: #23393c;
    --warn: #e08b7c;
    --ok: #49c98a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--sans);
}

/* ---------------------------------------------------------------- public

   The landing page and the dictionary are read, not worked in, so they keep
   comfortable reading sizes at every width. */

body.public {
  font-size: 16px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page { flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: 40px 16px; }
.brand { font-size: 44px; letter-spacing: -0.02em; margin: 0 0 8px; color: var(--ink); }
.hero { padding: 48px 0; }
.lede { font-size: 19px; margin: 0 0 8px; }
.foot { color: var(--text-soft); font-size: 13px; text-align: center; padding: 20px 16px; }

/* ---------------------------------------------------------------- console

   The opposite trade: this is a working surface with a great deal to fit, so
   the type gets SMALLER as the viewport grows. A wider screen here is room
   for more rows, not for bigger letters. Everything below is sized off --fs,
   through explicit multiples rather than nested em, so a change to one number
   moves the whole panel and nothing compounds. */

body.console {
  --fs: 14px;            /* phones: still has to be legible in the hand */
  --gap: 12px;
  --side: 200px;

  font-size: var(--fs);
  line-height: 1.45;
  margin: 0;
}

@media (min-width: 768px)  { body.console { --fs: 13px;   --gap: 13px; --side: 208px; } }
@media (min-width: 1024px) { body.console { --fs: 12.5px; --gap: 14px; --side: 216px; } }
@media (min-width: 1440px) { body.console { --fs: 12px;   --gap: 15px; --side: 228px; } }

body.console {
  --fs-xs: calc(var(--fs) * 0.85);
  --fs-sm: calc(var(--fs) * 0.92);
  --fs-lg: calc(var(--fs) * 1.15);
  --fs-xl: calc(var(--fs) * 1.35);
}

.shell { display: flex; min-height: 100vh; }

/* --- sidebar --- */

.side {
  width: var(--side);
  flex: 0 0 var(--side);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: calc(var(--gap) * 0.5);
  position: sticky;
  top: 0;
  /* dvh so a browser with a retracting toolbar does not put the last item
     under it; vh first for anything that does not know dvh. */
  height: 100vh;
  height: 100dvh;
  padding-bottom: calc(var(--gap) * 1.6);
}

.side .mark {
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  padding: calc(var(--gap) * 0.4) calc(var(--gap) * 0.4) var(--gap);
}

.side nav { display: flex; flex-direction: column; gap: 1px; }

.side .group {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  margin: var(--gap) 0 calc(var(--gap) * 0.3);
  padding: 0 calc(var(--gap) * 0.4);
}

.side nav a {
  display: block;
  padding: calc(var(--gap) * 0.42) calc(var(--gap) * 0.55);
  border-radius: 7px;
  color: var(--text);
  text-decoration: none;
}
.side nav a:hover { background: var(--surface-alt); }

.side .out { margin-top: auto; }
.side .out button {
  width: 100%;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-soft);
  border-radius: 7px;
  padding: calc(var(--gap) * 0.42) calc(var(--gap) * 0.55);
  cursor: pointer;
  font: inherit;
  text-align: start;
}
.side .out button:hover { color: var(--text); border-color: var(--text-soft); }

/* --- main --- */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: baseline;
  gap: var(--gap);
  padding: var(--gap) calc(var(--gap) * 1.4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
}
.topbar h1 { font-size: var(--fs-lg); font-weight: 600; margin: 0; color: var(--ink); }
.topbar .who { margin-inline-start: auto; display: flex; gap: calc(var(--gap) * 0.6); align-items: baseline; }
.topbar .name { font-weight: 600; }
.topbar .role {
  font-size: var(--fs-xs);
  color: var(--text-soft);
  background: var(--surface-alt);
  border-radius: 5px;
  padding: 2px 6px;
}

.content { padding: calc(var(--gap) * 1.4); display: flex; flex-direction: column; gap: var(--gap); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: calc(var(--gap) * 1.1);
  overflow-x: auto;
}
.panel h2 { font-size: var(--fs-lg); font-weight: 600; margin: 0 0 var(--gap); color: var(--ink); }

/* Dense tables: the reason the type is small in the first place. */
.console table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.console th, .console td {
  text-align: start;
  padding: calc(var(--gap) * 0.4) calc(var(--gap) * 0.55);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  white-space: nowrap;
}
.console th {
  color: var(--text-soft);
  font-weight: 600;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.console tbody tr:last-child td { border-bottom: 0; }
.console tbody tr:hover { background: var(--surface-alt); }
.console code { font-family: var(--mono); font-size: var(--fs-xs); }
/* Times, addresses and counts line up when their digits are the same width. */
.console .num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: var(--fs-xs); }

.facts { display: grid; grid-template-columns: minmax(90px, 140px) 1fr; gap: calc(var(--gap) * 0.35) var(--gap); margin: 0; }
.facts dt { color: var(--text-soft); }
.facts dd { margin: 0; }

/* Narrow screens: the sidebar stops being a column and rides along the top. */
@media (max-width: 767px) {
  .shell { flex-direction: column; }
  .side {
    width: auto;
    flex: none;
    height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: calc(var(--gap) * 0.4);
  }
  .side .mark { padding: 0; }
  .side nav { flex-direction: row; flex-wrap: wrap; gap: calc(var(--gap) * 0.3); }
  .side .group { display: none; }
  .side .out { margin-inline-start: auto; margin-top: 0; }
  .side .out button { width: auto; }
}

/* ------------------------------------------------- shared odds and ends */

h1 { font-size: 24px; margin: 0 0 12px; color: var(--ink); }
.soft { color: var(--text-soft); margin: 4px 0; }
.ok { color: var(--ok); }
.warn {
  color: var(--warn);
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 16px;
}

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; }
.narrow { max-width: 460px; margin: 40px auto; }
.center { text-align: center; }

.button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-weight: 600;
}

/* The QR is served by GlobalTrustID and stays legible on a dark background,
   so it keeps a white plate of its own rather than inverting with the page. */
.qr { background: #fff; border-radius: 12px; padding: 12px; margin: 18px auto; display: block; }
