/* okis console.
 *
 * One stylesheet, no framework, no build step — same as before. What changed
 * is the shape of the thing it is styling: a public cloud console is looked
 * at all day by people who are answerable for what is in it, and a panel
 * that grew out of "tables of things and buttons that act on them" had run
 * out of room to say which of those things matter.
 *
 * The rules are ordered the way a page is built: tokens, then the shell
 * every page sits inside, then the components pages are made of.
 *
 * Two constraints shape all of it. The content security policy is
 * `style-src 'self'` with no 'unsafe-inline', so there is no style attribute
 * anywhere and nothing a template can compute into one — everything that
 * varies is a class. And there is no build step, so this is plain CSS that
 * ships exactly as written.
 */

/* ---------------------------------------------------------------- tokens */

/* The palette is a neutral ramp and a brand ramp, and every colour in the
 * console comes out of them. Naming them by lightness rather than by use
 * ("--n-200", not "--border") is what keeps the dark theme a short block at
 * the end instead of a second stylesheet: the semantic names below get
 * reassigned, the ramps never do.
 */

:root {
  color-scheme: light;

  --n-0:   #ffffff;
  --n-25:  #fcfcfd;
  --n-50:  #f7f8fa;
  --n-100: #eff1f5;
  --n-150: #e7eaf0;
  --n-200: #dfe3ea;
  --n-300: #cbd1dc;
  --n-400: #9ba3b4;
  --n-500: #6e768a;
  --n-600: #4f5769;
  --n-700: #3a4152;
  --n-800: #262c3a;
  --n-900: #171c27;
  --n-950: #0d1119;

  /* okis green. The panel has always been this colour; it is a ramp now so
   * that a hover, a selected row and a focus ring can be three different
   * greens rather than one green at three opacities. */
  --brand-50:  #edf6f2;
  --brand-100: #d4ebe1;
  --brand-200: #a9d7c4;
  --brand-300: #76bda4;
  --brand-400: #46a084;
  --brand-500: #2a8369;
  --brand-600: #1f6b56;
  --brand-700: #1a5546;
  --brand-800: #16453a;
  --brand-900: #123830;

  /* State. Each one is a foreground, a wash to sit it on and a border,
   * because a status that is only coloured text is hard to find in a long
   * table and impossible to find for anyone who does not separate red from
   * green. Every one of them is paired with a word, and most with a shape. */
  --ok-fg:   #16704a;
  --ok-bg:   #e7f5ee;
  --ok-line: #a8dcc3;

  --bad-fg:   #b02a1e;
  --bad-bg:   #fdecea;
  --bad-line: #f3bdb6;

  --warn-fg:   #96590a;
  --warn-bg:   #fdf3e3;
  --warn-line: #f0d4a3;

  --info-fg:   #1a56c4;
  --info-bg:   #eaf1fd;
  --info-line: #bcd2f6;

  /* Semantic surfaces. These are what the rest of the file refers to. */
  --bg:        var(--n-50);
  --surface:   var(--n-0);
  --surface-2: var(--n-50);
  --surface-3: var(--n-100);

  --rail:        var(--n-900);
  --rail-ink:    #c9cfdc;
  --rail-dim:    #7f889c;
  --rail-hover:  rgba(255, 255, 255, 0.06);
  --rail-active: rgba(255, 255, 255, 0.10);
  --rail-line:   rgba(255, 255, 255, 0.08);

  --ink:       var(--n-900);
  --ink-2:     var(--n-700);
  --muted:     var(--n-500);
  --faint:     var(--n-400);
  --line:      var(--n-200);
  --line-soft: var(--n-150);

  --accent:       var(--brand-600);
  --accent-hover: var(--brand-700);
  --accent-wash:  var(--brand-50);
  --accent-line:  var(--brand-200);
  --on-accent:    #ffffff;

  --radius:      8px;
  --radius-sm:   6px;
  --radius-lg:   12px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(16, 22, 34, 0.05);
  --shadow:    0 1px 2px rgba(16, 22, 34, 0.06), 0 1px 3px rgba(16, 22, 34, 0.04);
  --shadow-lg: 0 8px 24px rgba(16, 22, 34, 0.12), 0 2px 6px rgba(16, 22, 34, 0.06);
  --ring:      0 0 0 3px var(--brand-100);

  /* The two series a graph draws. They are the brand green and a blue that
   * is not on the state ramp, because a line on a chart is not a status —
   * red and amber there would read as something being wrong. */
  --chart-1: var(--brand-500);
  --chart-2: #4a7fd4;

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --rail-w:           248px;
  --rail-w-collapsed:  64px;
  --topbar-h:          56px;
  --content-max:     1360px;
}

/* The dark theme, applied two ways because both are needed. `data-theme` is
 * an explicit choice, kept in this browser and set before first paint by
 * boot.js; the media query is for everyone who never touched the switch.
 * The `:not([data-theme="light"])` guard is what stops someone who
 * deliberately chose light from being overruled by their operating system. */

:root[data-theme="dark"] { color-scheme: dark; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }

  :root:not([data-theme="light"]) {
    --bg:        #0d1119;
    --surface:   #151a24;
    --surface-2: #1b212d;
    --surface-3: #222937;

    --rail:     #080c12;
    --rail-ink: #c3cad8;
    --rail-dim: #767f93;

    --ink:       #e8ebf1;
    --ink-2:     #c3cad8;
    --muted:     #8b94a8;
    --faint:     #6b7488;
    --line:      #262d3b;
    --line-soft: #1f2532;

    --accent:       var(--brand-300);
    --accent-hover: var(--brand-200);
    --accent-wash:  rgba(118, 189, 164, 0.10);
    --accent-line:  rgba(118, 189, 164, 0.32);
    --on-accent:    #08211a;

    --ok-fg:   #63c79b;
    --ok-bg:   rgba(99, 199, 155, 0.12);
    --ok-line: rgba(99, 199, 155, 0.32);

    --bad-fg:   #f08b81;
    --bad-bg:   rgba(240, 139, 129, 0.12);
    --bad-line: rgba(240, 139, 129, 0.32);

    --warn-fg:   #e0b667;
    --warn-bg:   rgba(224, 182, 103, 0.12);
    --warn-line: rgba(224, 182, 103, 0.32);

    --info-fg:   #84aef5;
    --info-bg:   rgba(132, 174, 245, 0.12);
    --info-line: rgba(132, 174, 245, 0.32);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.40);
    --shadow:    0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
    --ring:      0 0 0 3px rgba(118, 189, 164, 0.25);

    /* Lifted off the dark ground: the light theme's greens go muddy on it. */
    --chart-1: var(--brand-300);
    --chart-2: #7aa7ec;
  }
}

:root[data-theme="dark"] {
  --bg:        #0d1119;
  --surface:   #151a24;
  --surface-2: #1b212d;
  --surface-3: #222937;

  --rail:     #080c12;
  --rail-ink: #c3cad8;
  --rail-dim: #767f93;

  --ink:       #e8ebf1;
  --ink-2:     #c3cad8;
  --muted:     #8b94a8;
  --faint:     #6b7488;
  --line:      #262d3b;
  --line-soft: #1f2532;

  --accent:       var(--brand-300);
  --accent-hover: var(--brand-200);
  --accent-wash:  rgba(118, 189, 164, 0.10);
  --accent-line:  rgba(118, 189, 164, 0.32);
  --on-accent:    #08211a;

  --ok-fg:   #63c79b;
  --ok-bg:   rgba(99, 199, 155, 0.12);
  --ok-line: rgba(99, 199, 155, 0.32);

  --bad-fg:   #f08b81;
  --bad-bg:   rgba(240, 139, 129, 0.12);
  --bad-line: rgba(240, 139, 129, 0.32);

  --warn-fg:   #e0b667;
  --warn-bg:   rgba(224, 182, 103, 0.12);
  --warn-line: rgba(224, 182, 103, 0.32);

  --info-fg:   #84aef5;
  --info-bg:   rgba(132, 174, 245, 0.12);
  --info-line: rgba(132, 174, 245, 0.32);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.40);
  --shadow:    0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
  --ring:      0 0 0 3px rgba(118, 189, 164, 0.25);

  --chart-1: var(--brand-300);
  --chart-2: #7aa7ec;
}

/* ----------------------------------------------------------------- reset */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.011em; line-height: 1.3; }

p { margin: 0 0 0.75rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

svg { flex: none; }

/* One focus ring, everywhere, and only for keyboards. A console like this is
 * driven from the keyboard more than most software, and a ring the mouse
 * also triggers is one the first person it annoys turns off. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Anything that scrolls gets a thin scrollbar rather than the operating
 * system's, which on Windows is seventeen pixels of grey down the middle of
 * a table. */
* { scrollbar-width: thin; scrollbar-color: var(--n-300) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--n-300);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--n-400); background-clip: content-box; }

/* For a screen reader and nothing else: the words a sighted person gets from
 * an icon or from position. "(opens in a new tab)" beside the terminal link
 * is the case this exists for — a link that moves you to another tab without
 * saying so is disorienting when you cannot see it happen. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* First in the tab order on every page, visible only once focused. Twenty
 * navigation links is a lot to walk past to reach the table. */
.skip {
  position: absolute;
  left: -9999px;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-sm);
}
.skip:focus { left: 1rem; top: 1rem; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ----------------------------------------------------------------- shell */

/* The console is a fixed rail, a sticky top bar and a scrolling column of
 * content. The rail is fixed rather than in the flow so that a long table
 * scrolls under it: where you are in the platform should not scroll away
 * while you are reading one page of it. */

.app { min-height: 100vh; }

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  background: var(--rail);
  border-right: 1px solid var(--rail-line);
  overflow: hidden;
}

.rail-head {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  height: var(--topbar-h);
  padding: 0 0.875rem;
  flex: none;
  border-bottom: 1px solid var(--rail-line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
}
.brand:hover { color: #fff; text-decoration: none; }

.brand-mark {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(145deg, var(--brand-400), var(--brand-700));
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.brand-name { white-space: nowrap; overflow: hidden; }
.brand-name .tld { color: var(--brand-300); }

/* The scroll region of the rail. The groups scroll; the brand above and the
 * footer below stay put. */
.rail-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem 0.625rem 1rem;
}

/* The space switch: project on the left, platform on the right, and the one
 * you are in lit. Two links rather than a select because there are exactly
 * two of them and both fit — and because the answer to "which am I looking
 * at" should be a word you can see, not one behind a dropdown.
 *
 * It sits at the top of the rail rather than in the top bar on purpose. It
 * changes what the whole rail below it says, and a control that reorganises
 * a list belongs above that list. */
.space-switch {
  display: flex;
  gap: 2px;
  padding: 2px;
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
}

.space-switch a {
  flex: 1;
  padding: 0.3125rem 0.5rem;
  border-radius: 4px;
  color: var(--rail-dim);
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
}
.space-switch a:hover { color: #fff; text-decoration: none; }
.space-switch a.current {
  background: var(--brand-600);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* Collapsed, the two words do not fit. The switch becomes the initial of
 * each, stacked, which still says which one is lit. */
:root.rail-collapsed .space-switch { flex-direction: column; }
:root.rail-collapsed .space-switch a {
  padding: 0.3125rem 0;
  font-size: 0.6875rem;
  text-overflow: clip;
}

.nav-group + .nav-group { margin-top: 1.125rem; }

.nav-group-label {
  padding: 0 0.625rem 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--rail-dim);
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6875rem;
  padding: 0.4375rem 0.625rem;
  margin-bottom: 1px;
  border-radius: var(--radius-sm);
  color: var(--rail-ink);
  font-size: 0.875rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.nav-item:hover { background: var(--rail-hover); color: #fff; text-decoration: none; }
.nav-item svg { width: 17px; height: 17px; opacity: 0.75; }

.nav-item.current {
  background: var(--rail-active);
  color: #fff;
  font-weight: 500;
  box-shadow: inset 2px 0 0 var(--brand-300);
}
.nav-item.current svg { opacity: 1; color: var(--brand-300); }

.nav-label { overflow: hidden; text-overflow: ellipsis; }

.rail-foot {
  flex: none;
  padding: 0.625rem;
  border-top: 1px solid var(--rail-line);
}

/* Collapsed: icons only, 64px. The labels are hidden rather than removed so
 * that a screen reader still reads the link, and the title attribute gives a
 * pointer the name back. */
:root.rail-collapsed .rail { width: var(--rail-w-collapsed); }
:root.rail-collapsed .rail-head { padding: 0 0.5rem; justify-content: center; }
:root.rail-collapsed .brand-name,
:root.rail-collapsed .nav-label,
:root.rail-collapsed .nav-group-label,
:root.rail-collapsed .rail-foot .meta { display: none; }
:root.rail-collapsed .nav-item { justify-content: center; padding-inline: 0; }
:root.rail-collapsed .nav-group + .nav-group {
  margin-top: 0.625rem;
  padding-top: 0.625rem;
  border-top: 1px solid var(--rail-line);
}
:root.rail-collapsed .shell { margin-left: var(--rail-w-collapsed); }

/* The version and build, small and dim. It belongs in the chrome: the first
 * question about a console that is behaving oddly is which one it is. */
.rail-foot .meta {
  font-size: 0.6875rem;
  line-height: 1.5;
  color: var(--rail-dim);
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell {
  margin-left: var(--rail-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--topbar-h);
  padding: 0 1.25rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
}

.icon-button {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.icon-button:hover { background: var(--surface-3); color: var(--ink); }
.icon-button svg { width: 17px; height: 17px; }

/* The rail toggle is on the top bar rather than in the rail so that it is in
 * the same place whether the rail is open, collapsed or off-canvas. */
.rail-toggle { margin-left: -0.375rem; }

.crumbs {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--faint); }
.crumbs .here {
  color: var(--ink);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-spacer { flex: 1; }

.topbar-tools { display: flex; align-items: center; gap: 0.375rem; }

.topbar-divider {
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 0.25rem;
}

/* The project switcher. It is the single most consequential control in the
 * console — everything below it is scoped to whatever it says — so it is
 * labelled rather than being a bare select that looks like a filter. */
.switcher { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }

.switcher-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}

.switcher select {
  width: auto;
  max-width: 15rem;
  padding: 0.3125rem 1.75rem 0.3125rem 0.625rem;
  font-weight: 500;
  font-size: 0.8125rem;
}

/* The account menu. It opens from a button rather than on hover, because a
 * sign-out that a passing cursor can reveal is a sign-out somebody hits by
 * accident. */
.menu { position: relative; }

.menu-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 13rem;
  padding: 0.25rem 0.5rem 0.25rem 0.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}
.menu-button:hover { background: var(--surface-3); }
.menu-button[aria-expanded="true"] { background: var(--surface-3); border-color: var(--line); }

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-600);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.menu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  min-width: 15rem;
  padding: 0.3125rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.menu-head {
  padding: 0.5rem 0.625rem 0.625rem;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 0.3125rem;
}
.menu-head .who { font-weight: 600; overflow-wrap: anywhere; }
.menu-head .role { font-size: 0.75rem; color: var(--muted); }

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4375rem 0.625rem;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.8125rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-item:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.menu-item svg { width: 15px; height: 15px; color: var(--muted); }
.menu-item.danger { color: var(--bad-fg); }
.menu-item.danger svg { color: var(--bad-fg); }
.menu-item.danger:hover { background: var(--bad-bg); color: var(--bad-fg); }

.menu-sep { height: 1px; margin: 0.3125rem 0; background: var(--line-soft); }

/* The theme switch is three radio-ish buttons rather than a toggle, because
 * "follow the system" is a real answer and a two-state toggle cannot say it. */
.theme-switch {
  display: flex;
  gap: 2px;
  padding: 0.375rem 0.625rem 0.5rem;
}
.theme-switch button {
  flex: 1;
  padding: 0.3125rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.6875rem;
  cursor: pointer;
}
.theme-switch button:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.theme-switch button:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.theme-switch button + button { margin-left: -1px; }
.theme-switch button[aria-pressed="true"] {
  background: var(--accent-wash);
  border-color: var(--accent-line);
  color: var(--accent);
  font-weight: 600;
  position: relative;
}

/* --------------------------------------------------------------- content */

.content {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  padding: 1.5rem 1.5rem 4rem;
}

/* The page heading sits on the background, above the cards, rather than
 * inside the first one. A title inside a card reads as that card's title,
 * which was wrong on every page that had more than one. */
.page-head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.page-title-row { display: flex; align-items: center; gap: 0.625rem; flex-wrap: wrap; }

.page-head h1 {
  font-size: 1.375rem;
  letter-spacing: -0.02em;
}

.page-head .subtitle {
  margin: 0.3125rem 0 0;
  max-width: 68ch;
  color: var(--muted);
  font-size: 0.8125rem;
}

.page-titles { min-width: 0; flex: 1; }

.page-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ----------------------------------------------------------------- cards */

/* A card is one subject. Pages used to be a single panel with h2 headings
 * inside it, which made a VM's disks look like part of the VM's own facts;
 * now each heading that introduced a different subject is its own card. */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card + .card,
.card + .cards,
.cards + .card { margin-top: 1.25rem; }

.card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.875rem 1.125rem;
  border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { font-size: 0.9375rem; }
.card-head .subtitle { margin: 0.125rem 0 0; color: var(--muted); font-size: 0.8125rem; }
.card-head .titles { min-width: 0; flex: 1; }
.card-head .card-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }

/* A card whose whole body is one table wants no padding — the table's own
 * cell padding is the margin, and a double inset looks like a mistake. */
.card-body { padding: 1.125rem; }
.card-body > .table-wrap { margin: -1.125rem; width: auto; }
.card > .table-wrap:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card > .table-wrap:last-child { border-radius: 0 0 var(--radius) var(--radius); }

.card-foot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.875rem 1.125rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* A card foot is a row of buttons, and the destructive one goes to the far
 * right — away from the one that is pressed on purpose. The spacer is what
 * pushes it there. */
.card-foot .spacer { flex: 1; }

/* A subject inside a card that has several: one security group among the
 * project's groups. It is not a card of its own because the group is not the
 * subject of the page — networking is — but it still needs a name over its
 * own table. */
.group + .group { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line-soft); }
.group-head {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  flex-wrap: wrap;
  margin-bottom: 0.625rem;
}
.group-head h3 { font-size: 0.875rem; }

/* A table inside a card body, rather than filling the card, keeps its own
 * rounded edge and border instead of running to the card's. */
.card-body > .group .table-wrap,
.card-body > .table-wrap.boxed {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.card-body > .group .table-wrap { margin: 0; width: 100%; }
.card-body > .group thead th:first-child { border-top-left-radius: var(--radius-sm); }
.card-body > .group thead th:last-child { border-top-right-radius: var(--radius-sm); }

/* Two or three cards across, collapsing to one. Used for the summary tiles
 * at the top of a page. */
.cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

/* A page that is one short form — sign in, accept an invitation, change a
 * role — is centred and narrow rather than a full-width card with an acre of
 * white to the right of the fields. */
.narrow {
  max-width: 27rem;
  margin: 0 auto;
}

/* ---------------------------------------------------------------- tables */

/* The table is the console. Everything here is in service of reading a
 * column quickly: one horizontal rule per row and none between columns, a
 * header that is quiet enough to skip and distinct enough to find, and
 * identifiers in a monospace face so that two that differ by one character
 * look different. */

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.5rem 0.875rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

tbody td {
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color 0.1s ease; }
tbody tr:hover { background: var(--surface-2); }

/* The first cell of a row is the name of the thing, and usually the link to
 * it. It carries a little more weight than the rest so that the eye can run
 * down the column. */
tbody td:first-child { font-weight: 500; color: var(--ink); }
tbody td:first-child a { font-weight: 500; }

td.mono, .mono { font-family: var(--mono); font-size: 0.78125rem; letter-spacing: -0.01em; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* The actions column. It is right-aligned and its controls are quiet until
 * the row is hovered: a table with a column of loud red "delete"s reads as a
 * page about deleting things. */
td.actions, th.actions { text-align: right; white-space: nowrap; }
td.actions > * { vertical-align: middle; }
td.actions > * + * { margin-left: 0.75rem; }
td.actions a, td.actions button.link { color: var(--muted); }
tr:hover td.actions a, tr:hover td.actions button.link { color: var(--accent); }
tr:hover td.actions button.link.danger { color: var(--bad-fg); }

/* A row that is not a row: the "nothing here" line inside a table body. */
td.nothing { color: var(--muted); text-align: center; padding: 1.75rem 1rem; }

/* --------------------------------------------------------------- key/val */

/* The facts list: what a thing is, as opposed to what is in it. A grid
 * rather than a table because there is no second row to line up with, and
 * two columns on a wide screen because the lists are short and a column of
 * fifteen labels with an inch of white beside each is a waste of a screen. */
.facts {
  display: grid;
  grid-template-columns: minmax(7rem, auto) 1fr;
  gap: 0;
  margin: 0;
}

.facts dt {
  padding: 0.5rem 1rem 0.5rem 0;
  color: var(--muted);
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--line-soft);
}
.facts dd {
  margin: 0;
  padding: 0.5rem 0;
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--line-soft);
  overflow-wrap: anywhere;
}
.facts dt:last-of-type, .facts dd:last-of-type { border-bottom: none; }

@media (min-width: 62rem) {
  .facts.two { grid-template-columns: minmax(7rem, auto) 1fr minmax(7rem, auto) 1fr; }
  .facts.two dd { padding-right: 2rem; }
}

/* --------------------------------------------------------------- metrics */

/* A number on its own — 3 VMs, 40 GiB — says nothing about whether it is a
 * lot. Every metric here is shown against what it is allowed to be. */
.metric {
  padding: 1rem 1.125rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.metric .label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.metric .value {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  margin-top: 0.25rem;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.metric .value .of { font-size: 0.8125rem; font-weight: 400; color: var(--muted); }

/* The meter. Its width is the one thing on the page that has to be computed
 * from data, and the policy forbids a style attribute — so it is quantised
 * to twentieths and each step is a class. Twenty steps is finer than anyone
 * reads a bar to, and it keeps the markup honest. */
.meter {
  position: relative;
  height: 6px;
  margin-top: 0.625rem;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.3s ease;
}
.meter.warn > span { background: var(--warn-fg); }
.meter.bad > span { background: var(--bad-fg); }

.meter .f0   { width: 0; }
.meter .f5   { width: 5%; }
.meter .f10  { width: 10%; }
.meter .f15  { width: 15%; }
.meter .f20  { width: 20%; }
.meter .f25  { width: 25%; }
.meter .f30  { width: 30%; }
.meter .f35  { width: 35%; }
.meter .f40  { width: 40%; }
.meter .f45  { width: 45%; }
.meter .f50  { width: 50%; }
.meter .f55  { width: 55%; }
.meter .f60  { width: 60%; }
.meter .f65  { width: 65%; }
.meter .f70  { width: 70%; }
.meter .f75  { width: 75%; }
.meter .f80  { width: 80%; }
.meter .f85  { width: 85%; }
.meter .f90  { width: 90%; }
.meter .f95  { width: 95%; }
.meter .f100 { width: 100%; }

/* ---------------------------------------------------------------- states */

/* A status is a word, a colour and a dot. The dot is the part that survives
 * a monochrome screen and colour blindness, and it is what makes a column of
 * statuses scannable without reading any of them. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.5rem 0.125rem 0.4375rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.badge.ok      { color: var(--ok-fg);   background: var(--ok-bg);   border-color: var(--ok-line); }
.badge.bad     { color: var(--bad-fg);  background: var(--bad-bg);  border-color: var(--bad-line); }
.badge.pending { color: var(--warn-fg); background: var(--warn-bg); border-color: var(--warn-line); }
.badge.info    { color: var(--info-fg); background: var(--info-bg); border-color: var(--info-line); }
.badge.muted   { color: var(--muted);   background: var(--surface-3); border-color: var(--line); }

/* A pending badge pulses. Only pending: a thing that is still happening is
 * the one status somebody is waiting on, and the movement is what tells them
 * the page is not stale. */
.badge.pending::before { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* The same four words as plain text, for cells where a pill would be noise —
 * a conditions table where every row is true or false. */
.ok      { color: var(--ok-fg); }
.bad     { color: var(--bad-fg); }
.pending { color: var(--warn-fg); }
.muted   { color: var(--muted); }
.faint   { color: var(--faint); }

.message {
  margin-left: 0.5rem;
  color: var(--muted);
  font-size: 0.75rem;
}

/* --------------------------------------------------------------- notices */

.notice {
  display: flex;
  gap: 0.625rem;
  padding: 0.75rem 0.875rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 0.8125rem;
}
.notice svg { width: 16px; height: 16px; margin-top: 1px; }
.notice p { margin: 0; }
.notice p + p { margin-top: 0.375rem; }

.notice.error { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-fg); }
.notice.warn  { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-fg); }
.notice.info  { background: var(--info-bg); border-color: var(--info-line); color: var(--info-fg); }

/* `.error` on its own is kept because it is what the server's message is
 * rendered into all over the panel. */
.error {
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--bad-line);
  border-radius: var(--radius);
  background: var(--bad-bg);
  color: var(--bad-fg);
  font-size: 0.8125rem;
}

/* Nothing here yet. An empty state that only says "none" wastes the one
 * moment when somebody is definitely going to read the page, so these have
 * room for a sentence about what the thing is for. */
.empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8125rem;
}
.empty .empty-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: 0 auto 0.75rem;
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--faint);
}
.empty .empty-icon svg { width: 20px; height: 20px; }
.empty strong { display: block; color: var(--ink); font-weight: 600; margin-bottom: 0.25rem; }
.empty p { max-width: 46ch; margin: 0 auto; }
.empty .empty-actions { margin-top: 1rem; }

/* Something shown once and never again: a token, a WireGuard private key, an
 * invitation link. Bordered and loud on purpose — somebody who scrolls past
 * it has lost it. */
.secret {
  margin-bottom: 1.25rem;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.secret-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--accent-wash);
  border-bottom: 1px solid var(--accent-line);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.8125rem;
}
.secret-head svg { width: 16px; height: 16px; }
.secret-body { padding: 1rem; }
.secret-body > p { font-size: 0.8125rem; }

.copyable { position: relative; }
.copyable pre {
  margin: 0;
  padding: 0.75rem 3rem 0.75rem 0.875rem;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.78125rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}
.copyable .copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.6875rem;
}

/* --------------------------------------------------------------- buttons */

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4375rem;
  padding: 0.4375rem 0.8125rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
button:hover, .button:hover {
  background: var(--surface-2);
  border-color: var(--n-300);
  color: var(--ink);
  text-decoration: none;
}
button:active, .button:active { transform: translateY(0.5px); }
button svg, .button svg { width: 15px; height: 15px; }

button[disabled], .button[disabled], button[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

/* The one action a page exists for. There is at most one per page head — a
 * screen with three primary buttons has no primary action. */
button.primary, .button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
button.primary:hover, .button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
}

button.danger, .button.danger {
  color: var(--bad-fg);
  border-color: var(--bad-line);
  background: var(--surface);
}
button.danger:hover, .button.danger:hover {
  background: var(--bad-bg);
  border-color: var(--bad-fg);
  color: var(--bad-fg);
}

button.ghost, .button.ghost {
  background: none;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
}
button.ghost:hover, .button.ghost:hover { background: var(--surface-3); color: var(--ink); }

button.sm, .button.sm { padding: 0.25rem 0.5rem; font-size: 0.75rem; }

/* A button that is really a link: the in-row verbs, and anything in a
 * sentence. It keeps the button element — it posts — and drops the chrome. */
button.link {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--accent);
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}
button.link:hover { background: none; color: var(--accent-hover); text-decoration: underline; }
button.link.danger { color: var(--bad-fg); border: none; background: none; }
button.link.danger:hover { background: none; color: var(--bad-fg); text-decoration: underline; }

form.inline { display: inline; margin: 0; }

/* A row of buttons at the end of a form or a detail page. The destructive
 * one is pushed to the far right, away from the one that is pressed on
 * purpose. */
.actions-bar {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}
.actions-bar .spacer { flex: 1; }

/* ----------------------------------------------------------------- forms */

label {
  display: block;
  margin-bottom: 0.3125rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-2);
}

input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 0.4375rem 0.625rem;
  border: 1px solid var(--n-300);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.8125rem;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

/* Hover and focus are for the controls that have a border to move. They used
 * to be written as bare `input`, which meant a checkbox — which has no border
 * — was given a border colour and a three-pixel square halo, and looked like
 * a different control again. */
:is(input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="search"], select, textarea):hover {
  border-color: var(--n-400);
}

:is(input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="search"], select, textarea):focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

/* Checkboxes and radios are the platform's own control, tinted to the
 * panel's accent and pinned to one size.
 *
 * One rule, because the same box appeared three ways before it: the browser's
 * blue in a table cell, the accent in a form, and a third size in a picker —
 * so "tick this" looked like a different thing depending on which page
 * somebody was on. accent-color rather than a drawn box: the platform's
 * checkbox is the one a person's keyboard, screen reader and high-contrast
 * mode already know, and redrawing it buys a shape and loses all of that. */
input[type="checkbox"], input[type="radio"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}

input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input::placeholder, textarea::placeholder { color: var(--faint); }

/* The arrow is drawn here rather than left to the platform, because a native
 * select next to a text input is two different heights and two different
 * corner radii on every operating system. The image is a data: URI, which
 * img-src allows. */
select {
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236e768a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

textarea {
  font-family: var(--mono);
  font-size: 0.78125rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 5rem;
}

/* A field is a label, a control, and the hint that goes with it. The hint
 * sits under the control it explains rather than at the end of the form,
 * where nobody reads it in time. */
.field { margin-bottom: 1rem; }
.field:last-child { margin-bottom: 0; }
.field .hint { margin: 0.3125rem 0 0; }

.hint { color: var(--muted); font-size: 0.75rem; line-height: 1.5; }

/* ---------------------------------------------------------------- tables */

/* The controls above a list: a filter box, and the columns to show.
 *
 * A GET form, so the view is in the URL — shareable, and something the live
 * stream can be handed. Nothing here is JavaScript: the filter submits, the
 * headings are links, and the column chooser is a <details>. */
.table-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.875rem;
}

.table-controls input[type="search"] {
  flex: 1 1 18rem;
  max-width: 28rem;
}

/* The column chooser. A <details> rather than a menu that needs script: it
 * opens, it closes, and it works before anything has loaded. */
.columns { position: relative; }
.columns summary { list-style: none; cursor: pointer; }
.columns summary::-webkit-details-marker { display: none; }

.columns-menu {
  position: absolute;
  right: 0;
  z-index: 20;
  min-width: 12rem;
  margin-top: 0.375rem;
  padding: 0.375rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md, 0 8px 24px rgb(0 0 0 / 0.12));
}

.column-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3125rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.8125rem;
  text-decoration: none;
}
.column-toggle:hover { background: var(--surface-2, var(--line)); }
.column-toggle .unchecked { color: var(--faint); }

/* A sortable heading is a link, and looks like the heading it is until the
 * pointer is on it. The arrow marks the one column the list is ordered by. */
th .sort {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: inherit;
  text-decoration: none;
}
th .sort:hover { color: var(--brand-600, var(--ink)); }
.sort-mark { color: var(--muted); font-size: 0.75rem; }

/* The select column, and the bar of things to do with what is selected. */
td.pick, th.pick { width: 1.5rem; padding-right: 0; vertical-align: middle; }

.card-foot.bulk {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Labels in a cell: small, and wrapping rather than stretching the row. */
.cell-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.chip.sm { padding: 0.0625rem 0.375rem; font-size: 0.6875rem; }

/* ---------------------------------------------------------------- picker */

/* A list of things that exist, to tick. Scrolls rather than growing without
 * bound: a project with two hundred VMs would otherwise push the button that
 * submits the form off the bottom of a long page. */
.picker {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.picker-group {
  margin: 0;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  max-height: 12rem;
  overflow-y: auto;
}

.picker-group legend {
  padding: 0 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

/* ----------------------------------------------------------------- chips */

/* A label on a VM. It reads as one token — key=value — because that is how
 * it is written in a security group's selector, and a chip split into two
 * styled halves would invite reading them as two things. */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.1875rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2, transparent);
  font-size: 0.75rem;
}

/* The remove button is deliberately quiet until it is hovered: a row of
 * chips with a red x on each reads as a list of things to delete. */
.chip-remove {
  border: 0;
  background: none;
  padding: 0 0.125rem;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1;
  cursor: pointer;
}
.chip-remove:hover, .chip-remove:focus-visible { color: var(--danger-fg, var(--ink)); }

/* One short form on a line: a couple of inputs and the button that submits
 * them, rather than a full field stack for two words. */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
/* By type, so that a checkbox added to one of these later is a checkbox and
 * not a twelve-rem-wide one. */
.inline-form input[type="text"], .inline-form input[type="search"],
.inline-form input[type="number"], .inline-form select {
  width: auto;
  min-width: 8rem;
  flex: 0 1 12rem;
}

.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 11rem; }

/* "Tick this, and here is what it means": one box and the words beside it.
 *
 * flex-start rather than centred, so a label that wraps onto a second line
 * keeps its box against the first line instead of floating halfway down. */
.check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.875rem 0;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--ink);
  cursor: pointer;
}
/* Sits on the text, not on the line box around it. */
.check input { margin-top: 0.09375rem; }

/* Inside a picker they are the rows of one list rather than separate
 * questions, so they lose the gap that separates one question from the next
 * — which at a dozen VMs was a list somebody had to scroll to read. */
.picker-group .check { margin: 0; padding: 0.125rem 0; }

/* A fieldset of related controls inside a longer form. */
.fieldset { padding-top: 1.25rem; margin-top: 1.25rem; border-top: 1px solid var(--line-soft); }
.fieldset:first-child { padding-top: 0; margin-top: 0; border-top: none; }
.fieldset > h3 {
  margin-bottom: 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
}

/* The alternative sign-in, folded away because an email is the ordinary case. */
.alt-signin { margin-top: 1.25rem; border-top: 1px solid var(--line-soft); padding-top: 1rem; }
.alt-signin > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.8125rem;
  list-style: none;
}
.alt-signin > summary::-webkit-details-marker { display: none; }
.alt-signin > summary::before { content: "▸ "; color: var(--faint); }
.alt-signin[open] > summary::before { content: "▾ "; }
.alt-signin > form { margin-top: 1rem; }

/* ------------------------------------------------------------------ misc */

code {
  padding: 0.0625rem 0.3125rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-3);
  font-family: var(--mono);
  font-size: 0.85em;
}

hr { height: 1px; margin: 1.25rem 0; border: none; background: var(--line); }

/* The sign-in page and the invitation pages have no rail: there is no
 * console to navigate yet. They get the mark, centred, and nothing else. */
.auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1.25rem 4rem;
}
.auth .brand { color: var(--ink); margin-bottom: 1.75rem; font-size: 1.0625rem; }
.auth .brand .tld { color: var(--accent); }
.auth .card { width: 100%; max-width: 25rem; box-shadow: var(--shadow-lg); }
.auth .card-body { padding: 1.5rem; }
.auth h1 { font-size: 1.125rem; margin-bottom: 0.375rem; }
.auth .card-body > .hint:first-of-type { margin-bottom: 1.25rem; }
.auth button[type="submit"] { width: 100%; margin-top: 0.25rem; }
.auth .footnote { margin-top: 1.25rem; max-width: 25rem; text-align: center; }

/* ---------------------------------------------------------------- toasts */

/* What happened, for the actions that have no page of their own. htmx posts
 * a stop or a start and the server answers 204; without this the only sign
 * that a button worked is the row changing a second later, and the only sign
 * that it failed is nothing at all. */
.toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(24rem, calc(100vw - 2rem));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 0.8125rem;
  animation: toast-in 0.18s ease-out;
}
.toast svg { width: 16px; height: 16px; margin-top: 1px; }
.toast.bad { border-color: var(--bad-line); color: var(--bad-fg); background: var(--bad-bg); }
.toast.ok { border-color: var(--ok-line); color: var(--ok-fg); background: var(--ok-bg); }
.toast .dismiss { margin-left: auto; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ----------------------------------------------------------------- modal */

/* The confirmation dialog. It used to be window.confirm, which cannot say
 * which VM it is about to delete in any typeface the page controls, and
 * which some browsers let a person suppress for the rest of the session —
 * on a page whose buttons delete disks. */
dialog.modal {
  width: min(28rem, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(13, 17, 25, 0.45); }

.modal-body { display: flex; gap: 0.875rem; padding: 1.25rem; }
.modal-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--warn-bg);
  color: var(--warn-fg);
}
.modal-icon svg { width: 18px; height: 18px; }
.modal-body h2 { font-size: 0.9375rem; margin-bottom: 0.25rem; }
.modal-body p { margin: 0; color: var(--muted); font-size: 0.8125rem; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---------------------------------------------------------------- charts */

/* The usage graphs.
 *
 * The SVG is built on the server — the policy allows no charting library and
 * no inline styles — so everything here colours and sizes what arrived as
 * markup. The paths carry classes rather than fills, which is what lets the
 * graphs follow the theme like the rest of the console.
 *
 * Exactly two across, and in reading order: CPU and memory on the first row —
 * what the VM is spending — then disk and network on the second, what it is
 * moving. Not auto-fit: on a wide screen that packed four graphs into one row
 * and each was too short and too narrow to read, which is the only thing a
 * graph is for. One column on a narrow screen, where two would be worse. */
.charts {
  display: grid;
  gap: 1.75rem 1.5rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 60rem) {
  .charts { grid-template-columns: 1fr; }
}

.chart { margin: 0; }

.chart figcaption {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  flex-wrap: wrap;
  margin-bottom: 0.375rem;
}

.chart-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
}

.chart-legend {
  display: flex;
  gap: 0.75rem;
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--muted);
}

/* A key is a word with its line's colour in front of it, because a legend
 * that only names the series leaves you matching words to lines by guessing. */
.chart-legend .key { display: inline-flex; align-items: center; gap: 0.3125rem; }
.chart-legend .key::before {
  content: "";
  width: 10px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}
.chart-legend .key.s1 { color: var(--chart-1); }
.chart-legend .key.s2 { color: var(--chart-2); }

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 11rem;
  overflow: visible;
}

/* The grid is barely there on purpose: it is for reading a height off, not
 * for looking at. */
.chart-svg .grid line {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}
.chart-svg .grid .axis { stroke: var(--line); stroke-dasharray: none; }

/* A rule under every time label, so a peak can be traced down to a time
 * rather than estimated by eye between the two ends. */
.chart-svg .grid .tick {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 2 6;
  opacity: 0.55;
}

.chart-svg .line {
  fill: none;
  stroke-width: 1.75;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart-svg .line.s1 { stroke: var(--chart-1); }
.chart-svg .line.s2 { stroke: var(--chart-2); }

/* The wash under a line, which is what makes a shape readable at this size.
 * It is faint enough that two overlapping series stay legible. */
.chart-svg .fill { stroke: none; }
.chart-svg .fill.s1 { fill: var(--chart-1); opacity: 0.14; }
.chart-svg .fill.s2 { fill: var(--chart-2); opacity: 0.14; }

/* What the VM is allowed. Dashed, so it reads as a ceiling rather than as
 * another measurement. */
.chart-svg .limit {
  stroke: var(--warn-fg);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  opacity: 0.7;
}
.chart-svg .limit-label {
  fill: var(--warn-fg);
  font-size: 12px;
  opacity: 0.85;
}

/* 12 units in a 640-unit box: rendered across half a card that is about
 * eleven actual pixels, which is readable. The 9px this was renders at four
 * or five and is not. */
.chart-svg .axis-label {
  fill: var(--faint);
  font-size: 12px;
  font-family: var(--sans);
}
.chart-svg .axis-label.time { fill: var(--muted); }

.chart-empty {
  display: grid;
  place-items: center;
  min-height: 6rem;
  margin: 0;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.8125rem;
  text-align: center;
  padding: 0.75rem;
}

.chart-foot { margin-top: 1rem; }

/* The time toggle: 1h, 1d, 7d. One control rather than three buttons,
 * because they are three positions of one choice. */
.segmented {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.segmented button {
  padding: 0.25rem 0.625rem;
  border: none;
  border-radius: 4px;
  background: none;
  box-shadow: none;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.segmented button:hover { background: var(--surface-3); color: var(--ink); }
.segmented button.current {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* -------------------------------------------------------------- terminal */

/* The VM console. xterm draws everything inside; this only gives it a dark
 * box to draw in. */
.terminal {
  padding: 0.625rem;
  background: #0b0e14;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

#console-state { font-size: 0.75rem; }

/* The terminal window.
 *
 * It is its own window, opened to be a terminal and nothing else, so the
 * terminal takes every pixel that is not the strip above it. A fixed height
 * would leave a band of empty page under a window somebody has just dragged
 * taller, which is the opposite of what dragging it taller was for. */
body.bare {
  height: 100vh;
  overflow: hidden;
}

.term-window {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 0.5rem;
  gap: 0.5rem;
}

/* The swap target has to be a flex item that does not grow, or the strip
 * would take half the window between two updates. */
#console-bar { flex: none; }

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.25rem 0.125rem;
}

.term-mark { display: flex; }
.term-mark .brand-mark { width: 22px; height: 22px; border-radius: 6px; }

.term-name {
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: -0.01em;
}

.term-spacer { flex: 1; }

/* The terminal itself: everything left over. min-height is what stops a flex
 * child refusing to shrink below its content and pushing the strip off the
 * top of a short window. */
.term-fill {
  flex: 1;
  min-height: 0;
}

.term-notice {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  color: var(--warn-fg);
  font-size: 0.8125rem;
}
.term-notice svg { width: 15px; height: 15px; margin-top: 1px; }
.term-notice p { margin: 0; }

/* -------------------------------------------------------------- narrower */

/* Under 960px the rail becomes a drawer: off-canvas, over the content,
 * behind a scrim, closed by Escape or by tapping the scrim. Tablet width is
 * where a 248px rail stops being worth a quarter of the screen. */
.scrim { display: none; }

@media (max-width: 60rem) {
  .rail {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  :root.rail-open .rail { transform: none; }
  :root.rail-collapsed .rail { width: var(--rail-w); }
  :root.rail-collapsed .brand-name,
  :root.rail-collapsed .nav-label,
  :root.rail-collapsed .nav-group-label,
  :root.rail-collapsed .rail-foot .meta { display: revert; }
  :root.rail-collapsed .nav-item { justify-content: flex-start; padding-inline: 0.625rem; }

  .shell, :root.rail-collapsed .shell { margin-left: 0; }

  :root.rail-open .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(13, 17, 25, 0.45);
  }

  .content { padding: 1.25rem 1rem 3rem; }
  .switcher-label { display: none; }
  .menu-name { display: none; }
}

@media (max-width: 40rem) {
  .topbar { padding: 0 0.75rem; gap: 0.5rem; }
  .crumbs .crumb:not(.here) { display: none; }
  .crumbs .sep { display: none; }
  .page-head { gap: 0.75rem; }
  .page-actions { width: 100%; }
  .card-body { padding: 1rem; }
  .card-head { padding: 0.75rem 1rem; }
  .facts { grid-template-columns: 1fr; }
  .facts dt { padding-bottom: 0; border-bottom: none; }
  .facts dd { padding-top: 0.125rem; }
  .toasts { right: 0.75rem; left: 0.75rem; bottom: 0.75rem; max-width: none; }
}

/* A marketplace image's picture. A fixed box, so a row is the same height
   with or without one, and object-fit so a picture that is not square is not
   stretched into one. */
td.icon-cell { width: 44px; padding-right: 0; }
img.image-icon { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; display: block; }
img.image-icon.large { width: 48px; height: 48px; }

/* How far an upload has got. Hidden until one starts, because a bar at zero
   on a form nobody has submitted reads as something already going wrong. */
.progress {
  height: 6px;
  margin-top: 0.5rem;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.progress-bar {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.2s ease;
}

/* A file input is the platform's, sized like the boxes around it. */
input[type="file"] {
  width: 100%;
  padding: 0.375rem;
  border: 1px dashed var(--n-300);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}
input[type="file"]:hover { border-color: var(--accent); }
