/*
 * Aquillus UI kit - one stylesheet for the desk web UI, Aquillus Cloud and the simulators.
 *
 * Design idea: the chrome is quiet so the content can speak. On a camera desk the content is colour -
 * the light of the keys, red for "on air", green for "preview". So every surface is a neutral grey, there
 * is one accent (a calm teal) that marks what can be acted on, and nothing glows or fades for decoration.
 * Hierarchy comes from type (size, weight and leading as a set), from grouping and from the depth of a
 * surface - not from borders around everything.
 *
 * The rules behind it (see docs/de/entwicklung/06-oberflaechen.md):
 *   - Feedback on press, not on release: every control reacts at pointer-down.
 *   - Things you drag follow the finger 1:1; when you let go they settle like a spring.
 *   - Floating chrome (sidebar, toolbar, sheets) is a translucent material; content scrolls beneath it.
 *   - Grouped lists instead of cards in cards; a hairline separates rows.
 *   - Tracking follows size: large type is set tighter, small type a little wider.
 *   - Reduced motion, reduced transparency and increased contrast are honoured.
 *
 * Usage: <link rel="stylesheet" href="/ui/aquillus.css"> and put class="aq" on <body>.
 * Theme: follows the system. Force one with <html data-theme="dark"> or <html data-theme="light">.
 */

@font-face { font-family: "Inter"; src: url("fonts/Inter-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  /* surfaces, from the back to the front */
  --aq-ink: #000000;        /* page */
  --aq-deck: #1c1c1e;       /* grouped surface: lists, panels */
  --aq-rail: #2c2c2e;       /* control fill: buttons, inputs, key caps */
  --aq-rail-2: #3a3a3c;     /* control fill while pressed or hovered */
  --aq-line: #38383a;       /* separator */
  --aq-petrol: #0f4c5c;     /* brand */
  --aq-signal: #40c8e0;     /* accent: what can be acted on, focus, links */
  --aq-on-signal: #00252d;  /* text on accent */
  --aq-text: #f5f5f7;
  --aq-muted: #98989f;      /* secondary text */
  --aq-faint: #636366;      /* tertiary text, placeholder, disabled */
  --aq-red: #ff453a;        /* on air / destructive */
  --aq-green: #30d158;      /* preview / on / ok */
  --aq-amber: #ff9f0a;      /* attention */
  --aq-on-red: #ffffff;
  --aq-on-green: #00210a;
  --aq-on-amber: #2b1900;
  --aq-thumb: #636366;      /* selected segment */
  --aq-knob: #ffffff;       /* switch and slider knob */
  --aq-green-fill: #30d158; /* "on" as a filled shape (switch, dot) - never as text */
  --aq-red-fill: #ff453a;
  --aq-amber-fill: #ff9f0a;
  --aq-onair-fill: #e0271b; /* solid red under white text: "on air", destructive buttons */
  --aq-desk: #1c1c1e;       /* the desk itself: surface under keys, faders and joystick - dark in every theme */
  --aq-key-cap: #2c2c2e;    /* a key that is not lit */
  --aq-key-ink: #f5f5f7;    /* legend of a key that is not lit */
  --aq-material: rgba(28, 28, 30, 0.72);   /* translucent chrome */
  --aq-hairline: rgba(255, 255, 255, 0.08);
  --aq-scrim: rgba(0, 0, 0, 0.5);
  --aq-shadow: 0 24px 64px rgba(0, 0, 0, 0.56), 0 2px 10px rgba(0, 0, 0, 0.32);

  /* type: one family, hierarchy from size + weight + leading */
  --aq-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --aq-font-legend: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  --aq-font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --aq-fs-xs: 0.75rem;      /* 12 caption */
  --aq-fs-sm: 0.8125rem;    /* 13 footnote */
  --aq-fs: 0.9375rem;       /* 15 body */
  --aq-fs-lg: 1.0625rem;    /* 17 headline */
  --aq-fs-xl: 1.375rem;     /* 22 title */
  --aq-fs-2xl: 1.75rem;     /* 28 large title */
  --aq-fs-3xl: 2.125rem;    /* 34 display */

  /* shape and space */
  --aq-r-sm: 6px;
  --aq-r: 10px;
  --aq-r-lg: 14px;
  --aq-r-xl: 22px;
  --aq-gap: 12px;
  --aq-touch: 44px;         /* minimum touch target */
  color-scheme: dark;
}

:root[data-theme="light"] {
  --aq-ink: #f5f5f7;
  --aq-deck: #ffffff;
  --aq-rail: #ececee;
  --aq-rail-2: #dedee2;
  --aq-line: #d2d2d7;
  --aq-signal: #00758c;
  --aq-on-signal: #ffffff;
  --aq-text: #1d1d1f;
  --aq-muted: #6e6e73;
  --aq-faint: #aeaeb2;
  --aq-red: #d70015;
  --aq-green: #1b7f35;
  --aq-amber: #b25000;
  --aq-on-red: #ffffff;
  --aq-on-green: #ffffff;
  --aq-on-amber: #ffffff;
  --aq-thumb: #ffffff;
  --aq-knob: #ffffff;
  --aq-green-fill: #34c759;
  --aq-red-fill: #ff3b30;
  --aq-amber-fill: #ff9500;
  --aq-onair-fill: #d70015;
  --aq-desk: #1d1d1f;
  --aq-material: rgba(250, 250, 252, 0.76);
  --aq-hairline: rgba(0, 0, 0, 0.08);
  --aq-scrim: rgba(0, 0, 0, 0.28);
  --aq-shadow: 0 24px 64px rgba(0, 0, 0, 0.16), 0 2px 10px rgba(0, 0, 0, 0.08);
  color-scheme: light;
}

/* Without a forced theme the kit follows the system. Same values as the block above. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --aq-ink: #f5f5f7;
    --aq-deck: #ffffff;
    --aq-rail: #ececee;
    --aq-rail-2: #dedee2;
    --aq-line: #d2d2d7;
    --aq-signal: #00758c;
    --aq-on-signal: #ffffff;
    --aq-text: #1d1d1f;
    --aq-muted: #6e6e73;
    --aq-faint: #aeaeb2;
    --aq-red: #d70015;
    --aq-green: #1b7f35;
    --aq-amber: #b25000;
    --aq-on-red: #ffffff;
    --aq-on-green: #ffffff;
    --aq-on-amber: #ffffff;
    --aq-thumb: #ffffff;
    --aq-knob: #ffffff;
    --aq-green-fill: #34c759;
    --aq-red-fill: #ff3b30;
    --aq-amber-fill: #ff9500;
    --aq-onair-fill: #d70015;
    --aq-desk: #1d1d1f;
    --aq-material: rgba(250, 250, 252, 0.76);
    --aq-hairline: rgba(0, 0, 0, 0.08);
    --aq-scrim: rgba(0, 0, 0, 0.28);
    --aq-shadow: 0 24px 64px rgba(0, 0, 0, 0.16), 0 2px 10px rgba(0, 0, 0, 0.08);
    color-scheme: light;
  }
}

.aq {
  /* motion: a critically damped settle - no overshoot unless a gesture carried momentum */
  --aq-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --aq-t-press: 90ms;
  --aq-t: 240ms;
  --aq-t-sheet: 380ms;
}

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

body.aq {
  margin: 0;
  background: var(--aq-ink);
  color: var(--aq-text);
  font: 400 var(--aq-fs)/1.47 var(--aq-font);
  letter-spacing: -0.006em;
  font-optical-sizing: auto;
  /* No contextual alternates: Inter would turn "0x40" into "0×40" and "->" into an arrow - addresses, versions
     and hex values must read exactly as they are. */
  font-feature-settings: "calt" 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

/* Type: the larger, the tighter the tracking and the leading. */
.aq h1, .aq h2, .aq h3 { font-family: var(--aq-font-legend); margin: 0; text-wrap: balance; }
.aq h1 { font-size: var(--aq-fs-2xl); font-weight: 700; line-height: 1.14; letter-spacing: -0.022em; }
.aq h2 { font-size: var(--aq-fs-xl); font-weight: 600; line-height: 1.22; letter-spacing: -0.018em; }
.aq h3 { font-size: var(--aq-fs-lg); font-weight: 600; line-height: 1.3; letter-spacing: -0.012em; }
.aq p { margin: 0; max-width: 68ch; text-wrap: pretty; }
.aq small, .aq-small { font-size: var(--aq-fs-sm); letter-spacing: 0; }
.aq a { color: var(--aq-signal); text-decoration: none; }
.aq a:hover { text-decoration: underline; text-underline-offset: 3px; }
.aq code, .aq kbd, .aq pre { font-family: var(--aq-font-mono); font-size: 0.9em; letter-spacing: 0; }
.aq pre { background: var(--aq-deck); border-radius: var(--aq-r-lg); padding: 14px 16px; overflow: auto; margin: 0; line-height: 1.5; }
.aq :focus { outline: none; }
.aq :focus-visible { outline: 3px solid color-mix(in srgb, var(--aq-signal) 60%, transparent); outline-offset: 2px; }
.aq ::selection { background: color-mix(in srgb, var(--aq-signal) 34%, transparent); }
.aq-muted { color: var(--aq-muted); }
.aq-faint { color: var(--aq-faint); }
.aq-num { font-variant-numeric: tabular-nums; }
.aq-hidden { display: none !important; }
.aq-title-large { font: 700 var(--aq-fs-3xl)/1.1 var(--aq-font-legend); letter-spacing: -0.026em; }
.aq-caption { font-size: var(--aq-fs-xs); line-height: 1.35; letter-spacing: 0.005em; color: var(--aq-muted); }
/* The line above a group, as in a settings list. Sentence case, never capitals. */
.aq .aq-group-title, .aq-group-title { font: 500 var(--aq-fs-sm)/1.4 var(--aq-font); color: var(--aq-muted); letter-spacing: 0; margin: 0 0 8px 16px; }
.aq .aq-group-foot, .aq-group-foot { font-size: var(--aq-fs-sm); color: var(--aq-muted); letter-spacing: 0; margin: 8px 16px 0; max-width: 68ch; }

/* ---------- layout ---------- */
.aq-app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.aq-nav {
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; z-index: 20;
  display: flex; flex-direction: column; gap: 2px; padding: 16px 10px;
  background: var(--aq-material);
  -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 1px 0 0 var(--aq-hairline);
}
.aq-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; font: 600 var(--aq-fs-lg)/1.2 var(--aq-font-legend); letter-spacing: -0.014em; }
.aq-brand small { display: block; font: 400 var(--aq-fs-xs)/1.35 var(--aq-font); letter-spacing: 0; color: var(--aq-muted); }
.aq-nav a {
  display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 6px 10px; border-radius: 8px;
  color: var(--aq-text); text-decoration: none; font-weight: 500; font-size: var(--aq-fs-sm); letter-spacing: 0;
  transition: background-color var(--aq-t-press) linear;
}
.aq-nav a:hover { background: color-mix(in srgb, var(--aq-text) 6%, transparent); text-decoration: none; }
.aq-nav a:active { background: color-mix(in srgb, var(--aq-text) 12%, transparent); }
.aq-nav a svg { color: var(--aq-muted); flex: none; }
.aq-nav a[aria-current="page"] { background: color-mix(in srgb, var(--aq-text) 10%, transparent); }
.aq-nav a[aria-current="page"] svg { color: var(--aq-signal); }
.aq-nav hr { border: 0; height: 1px; background: var(--aq-hairline); margin: 8px 10px; }
.aq-nav .aq-nav-end { margin-top: auto; }
.aq-main { padding: 28px 32px 72px; min-width: 0; }
.aq-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--aq-gap); margin-bottom: 22px; }
.aq-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--aq-gap); }
.aq-stack { display: flex; flex-direction: column; gap: var(--aq-gap); }
.aq-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.aq-spacer { flex: 1; }

/* A bar that floats over scrolling content: material instead of a border. */
.aq-toolbar {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: var(--aq-gap); min-height: 52px; padding: 8px 32px;
  background: var(--aq-material);
  -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 0 1px 0 var(--aq-hairline);
}

@media (max-width: 860px) {
  .aq-app { grid-template-columns: 1fr; }
  .aq-nav { position: sticky; height: auto; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding: 8px 10px; box-shadow: 0 1px 0 var(--aq-hairline); scrollbar-width: none; }
  .aq-nav::-webkit-scrollbar { display: none; }
  .aq-brand { padding: 4px 10px 4px 4px; }
  .aq-brand small { display: none; }
  .aq-nav a { white-space: nowrap; }
  .aq-nav hr { display: none; }
  .aq-nav .aq-nav-end { margin-top: 0; margin-left: auto; }
  .aq-main { padding: 20px 16px 56px; }
  .aq-toolbar { padding: 8px 16px; }
}

/* ---------- surfaces ---------- */
.aq-panel { background: var(--aq-deck); border-radius: var(--aq-r-lg); padding: 18px 20px; box-shadow: 0 0 0 1px var(--aq-hairline); }
.aq-panel > h3 { margin-bottom: 12px; }
.aq-stat { font: 600 var(--aq-fs-2xl)/1.1 var(--aq-font-legend); letter-spacing: -0.022em; font-variant-numeric: tabular-nums; }
.aq-stat + .aq-muted { margin-top: 2px; font-size: var(--aq-fs-sm); }

/* A grouped list: rows on one surface, separated by a hairline that starts at the text. */
.aq-list { background: var(--aq-deck); border-radius: var(--aq-r-lg); box-shadow: 0 0 0 1px var(--aq-hairline); overflow: hidden; }
.aq-item { position: relative; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 8px 16px; }
.aq-item + .aq-item::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; height: 1px; background: var(--aq-hairline); }
.aq-item > .aq-item-label { flex: 1; min-width: 0; }
.aq-item > .aq-item-label small { display: block; color: var(--aq-muted); line-height: 1.35; }
.aq-item > .aq-item-value { color: var(--aq-muted); text-align: right; font-variant-numeric: tabular-nums; }
a.aq-item, button.aq-item { width: 100%; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-align: left; cursor: pointer; text-decoration: none; }
label.aq-item { cursor: pointer; }
a.aq-item:hover { text-decoration: none; }
a.aq-item:active, button.aq-item:active { background: var(--aq-rail); }

/* ---------- buttons ---------- */
.aq-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 6px 15px; border-radius: var(--aq-r); border: 0;
  background: var(--aq-rail); color: var(--aq-text);
  font: 500 var(--aq-fs)/1.2 var(--aq-font); letter-spacing: -0.006em;
  cursor: pointer; text-decoration: none; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: transform var(--aq-t) var(--aq-ease), background-color var(--aq-t) var(--aq-ease), opacity var(--aq-t) linear;
}
.aq-btn:hover { background: var(--aq-rail-2); text-decoration: none; }
/* Pressed: at once, without a transition - the way back is the spring. */
.aq-btn:active { transform: scale(0.97); background: var(--aq-rail-2); transition-duration: var(--aq-t-press); }
.aq-btn[disabled], .aq-btn[aria-disabled="true"] { opacity: 0.4; cursor: default; pointer-events: none; }
.aq-btn.primary { background: var(--aq-signal); color: var(--aq-on-signal); font-weight: 600; }
.aq-btn.primary:hover { background: color-mix(in srgb, var(--aq-signal) 90%, var(--aq-text)); }
/* Red text on a control fill: mixed a little towards the text colour so it stays readable in both themes. */
.aq-btn.danger { color: color-mix(in srgb, var(--aq-red) 80%, var(--aq-text)); }
.aq-btn.danger.solid { background: var(--aq-onair-fill); color: var(--aq-on-red); font-weight: 600; }
.aq-btn.quiet { background: transparent; color: var(--aq-signal); }
.aq-btn.quiet:hover, .aq-btn.quiet:active { background: color-mix(in srgb, var(--aq-signal) 12%, transparent); }
.aq-btn.quiet.danger { color: var(--aq-red); }
.aq-btn.quiet.danger:hover, .aq-btn.quiet.danger:active { background: color-mix(in srgb, var(--aq-red) 12%, transparent); }
.aq-btn.touch { min-height: var(--aq-touch); min-width: var(--aq-touch); }
.aq-btn.small { min-height: 28px; padding: 3px 11px; border-radius: 8px; font-size: var(--aq-fs-sm); letter-spacing: 0; }
.aq-btn.large { min-height: 50px; padding: 12px 22px; border-radius: var(--aq-r-lg); font-size: var(--aq-fs-lg); font-weight: 600; letter-spacing: -0.012em; }
.aq-btn svg { flex: none; }

/* One of several: the choice sits on a raised thumb. */
.aq-seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--aq-rail); }
.aq-seg > button {
  min-height: 30px; padding: 4px 14px; border: 0; border-radius: 7px; background: transparent; color: var(--aq-text);
  font: 500 var(--aq-fs-sm)/1.2 var(--aq-font); letter-spacing: 0; cursor: pointer; white-space: nowrap; touch-action: manipulation;
  transition: background-color var(--aq-t) var(--aq-ease), transform var(--aq-t) var(--aq-ease);
}
.aq-seg > button:active { transform: scale(0.97); transition-duration: var(--aq-t-press); }
.aq-seg > button[aria-pressed="true"], .aq-seg > button[aria-selected="true"] { background: var(--aq-thumb); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18), 0 0 0 0.5px rgba(0, 0, 0, 0.06); font-weight: 600; }
.aq-seg.touch > button { min-height: 40px; padding: 6px 18px; font-size: var(--aq-fs); }

/* ---------- forms ---------- */
.aq-field { display: flex; flex-direction: column; gap: 6px; }
.aq-field > span { font-size: var(--aq-fs-sm); font-weight: 500; letter-spacing: 0; color: var(--aq-muted); }
.aq-field > small { color: var(--aq-muted); font-size: var(--aq-fs-xs); line-height: 1.4; letter-spacing: 0.005em; }
.aq-input, .aq-select, .aq-textarea {
  min-height: 36px; padding: 6px 12px; border-radius: var(--aq-r); border: 0;
  background: var(--aq-rail); color: var(--aq-text); font: inherit; letter-spacing: inherit; width: 100%;
  transition: box-shadow var(--aq-t) var(--aq-ease), background-color var(--aq-t) var(--aq-ease);
}
.aq-input::placeholder, .aq-textarea::placeholder { color: var(--aq-faint); }
.aq-select { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--aq-muted) 50%), linear-gradient(135deg, var(--aq-muted) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.aq-textarea { min-height: 120px; resize: vertical; line-height: 1.45; padding: 10px 12px; }
.aq-input:focus-visible, .aq-select:focus-visible, .aq-textarea:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--aq-signal) 45%, transparent); }
.aq-input[aria-invalid="true"] { box-shadow: 0 0 0 2px var(--aq-red); }
.aq-check { display: inline-flex; align-items: center; gap: 9px; min-height: 32px; cursor: pointer; }
.aq-check input { width: 18px; height: 18px; accent-color: var(--aq-signal); }

/* On is green: the state reads without the label. */
.aq-switch { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; margin: 0; border-radius: 14px; background: var(--aq-rail-2); position: relative; cursor: pointer; flex: none; transition: background-color var(--aq-t) var(--aq-ease); touch-action: manipulation; }
.aq-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 12px; background: var(--aq-knob); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22), 0 0 0 0.5px rgba(0, 0, 0, 0.05); transition: transform var(--aq-t) var(--aq-ease), width var(--aq-t) var(--aq-ease); }
.aq-switch:active::after { width: 29px; }
.aq-switch:checked { background: var(--aq-green-fill); }
.aq-switch:checked::after { transform: translateX(18px); }
.aq-switch:checked:active::after { transform: translateX(13px); }

/* A slider: thin track, the travelled part filled (set --aq-p from 0 to 1; aquillus.js keeps it up to date). */
.aq-range { appearance: none; -webkit-appearance: none; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; touch-action: none; --aq-p: 0.5; }
.aq-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--aq-signal) calc(var(--aq-p) * 100%), var(--aq-rail-2) calc(var(--aq-p) * 100%)); }
.aq-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--aq-rail-2); }
.aq-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--aq-signal); }
.aq-range::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -10px; border-radius: 12px; border: 0; background: var(--aq-knob); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.24), 0 0 0 0.5px rgba(0, 0, 0, 0.08); transition: transform var(--aq-t) var(--aq-ease); }
.aq-range::-moz-range-thumb { width: 24px; height: 24px; border-radius: 12px; border: 0; background: var(--aq-knob); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.24), 0 0 0 0.5px rgba(0, 0, 0, 0.08); }
.aq-range:active::-webkit-slider-thumb { transform: scale(1.12); }
.aq-form { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.aq-form .wide { grid-column: 1 / -1; }

/* ---------- tables ---------- */
.aq-table-wrap { overflow-x: auto; border-radius: var(--aq-r-lg); background: var(--aq-deck); box-shadow: 0 0 0 1px var(--aq-hairline); }
.aq-table { width: 100%; border-collapse: collapse; font-size: var(--aq-fs-sm); letter-spacing: 0; }
.aq-table th { text-align: left; font-weight: 500; font-size: var(--aq-fs-xs); color: var(--aq-muted); padding: 10px 16px; border-bottom: 1px solid var(--aq-hairline); white-space: nowrap; }
.aq-table td { padding: 11px 16px; border-bottom: 1px solid var(--aq-hairline); vertical-align: middle; }
.aq-table tr:last-child td { border-bottom: 0; }
.aq-table tbody tr[data-href] { cursor: pointer; }
.aq-table tbody tr[data-href]:hover { background: color-mix(in srgb, var(--aq-text) 4%, transparent); }
.aq-table tbody tr[data-href]:active { background: color-mix(in srgb, var(--aq-text) 8%, transparent); }
.aq-empty { padding: 44px 20px; text-align: center; color: var(--aq-muted); }
.aq-empty strong { display: block; color: var(--aq-text); font: 600 var(--aq-fs-lg)/1.3 var(--aq-font-legend); letter-spacing: -0.012em; margin-bottom: 4px; }

/* ---------- status ---------- */
.aq-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 6px; font-size: var(--aq-fs-xs); font-weight: 500; letter-spacing: 0.005em; background: var(--aq-rail); color: color-mix(in srgb, var(--aq-muted) 70%, var(--aq-text)); white-space: nowrap; }
.aq-badge.ok { color: color-mix(in srgb, var(--aq-green) 78%, var(--aq-text)); background: color-mix(in srgb, var(--aq-green) 16%, transparent); }
.aq-badge.warn { color: color-mix(in srgb, var(--aq-amber) 78%, var(--aq-text)); background: color-mix(in srgb, var(--aq-amber) 16%, transparent); }
.aq-badge.bad { color: color-mix(in srgb, var(--aq-red) 78%, var(--aq-text)); background: color-mix(in srgb, var(--aq-red) 16%, transparent); }
.aq-badge.accent { color: color-mix(in srgb, var(--aq-signal) 78%, var(--aq-text)); background: color-mix(in srgb, var(--aq-signal) 16%, transparent); }
/* The two states that must be read across a room are solid. */
.aq-badge.onair { color: var(--aq-on-red); background: var(--aq-onair-fill); font-weight: 600; }
.aq-badge.preview { color: var(--aq-on-green); background: var(--aq-green); font-weight: 600; }
.aq-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--aq-faint); flex: none; }
.aq-dot.ok { background: var(--aq-green-fill); }
.aq-dot.bad { background: var(--aq-red-fill); }
.aq-dot.warn { background: var(--aq-amber-fill); }
.aq-note { background: var(--aq-rail); padding: 12px 16px; border-radius: var(--aq-r-lg); font-size: var(--aq-fs-sm); letter-spacing: 0; line-height: 1.45; }
.aq-note.warn { background: color-mix(in srgb, var(--aq-amber) 14%, var(--aq-deck)); }
.aq-note.bad { background: color-mix(in srgb, var(--aq-red) 14%, var(--aq-deck)); }
.aq-meter { height: 6px; border-radius: 3px; background: var(--aq-rail-2); overflow: hidden; }
.aq-meter > i { display: block; height: 100%; border-radius: 3px; background: var(--aq-signal); width: var(--v, 0%); transition: width var(--aq-t) var(--aq-ease); }

/* ---------- tabs, sheet, toast ---------- */
.aq-tabs { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--aq-rail); margin-bottom: 20px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.aq-tabs::-webkit-scrollbar { display: none; }
.aq-tabs button { min-height: 30px; padding: 4px 14px; border: 0; border-radius: 7px; background: transparent; color: var(--aq-text); font: 500 var(--aq-fs-sm)/1.2 var(--aq-font); letter-spacing: 0; cursor: pointer; white-space: nowrap; transition: background-color var(--aq-t) var(--aq-ease); }
.aq-tabs button[aria-selected="true"] { background: var(--aq-thumb); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18), 0 0 0 0.5px rgba(0, 0, 0, 0.06); font-weight: 600; }

/* A sheet arrives as a material: it grows a little and sharpens, and leaves the same way. */
dialog.aq-dialog {
  border: 0; border-radius: var(--aq-r-xl); padding: 0; width: min(560px, calc(100vw - 28px)); max-height: calc(100dvh - 40px);
  background: var(--aq-deck); color: var(--aq-text); box-shadow: var(--aq-shadow), 0 0 0 1px var(--aq-hairline);
  opacity: 0; transform: scale(0.96) translateY(8px);
  transition: opacity var(--aq-t) linear, transform var(--aq-t-sheet) var(--aq-ease), overlay var(--aq-t-sheet) allow-discrete, display var(--aq-t-sheet) allow-discrete;
}
dialog.aq-dialog[open] { opacity: 1; transform: none; }
@starting-style { dialog.aq-dialog[open] { opacity: 0; transform: scale(0.96) translateY(8px); } }
dialog.aq-dialog::backdrop { background: var(--aq-scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity var(--aq-t) linear, overlay var(--aq-t-sheet) allow-discrete, display var(--aq-t-sheet) allow-discrete; }
dialog.aq-dialog[open]::backdrop { opacity: 1; }
@starting-style { dialog.aq-dialog[open]::backdrop { opacity: 0; } }
.aq-dialog > header { padding: 22px 24px 0; }
.aq-dialog > .body { padding: 12px 24px 8px; display: flex; flex-direction: column; gap: 14px; max-height: 68vh; overflow-y: auto; }
.aq-dialog > footer { padding: 14px 24px 22px; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.aq-toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 50; pointer-events: none; }
.aq-toast {
  display: flex; align-items: center; gap: 10px; max-width: min(440px, calc(100vw - 32px)); padding: 11px 18px; border-radius: 999px; pointer-events: auto;
  background: var(--aq-material); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  box-shadow: var(--aq-shadow), 0 0 0 1px var(--aq-hairline); font-size: var(--aq-fs-sm); font-weight: 500; letter-spacing: 0;
  animation: aq-toast-in var(--aq-t-sheet) var(--aq-ease) both;
}
.aq-toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--aq-green-fill); flex: none; }
.aq-toast.bad::before { background: var(--aq-red-fill); }
.aq-toast.leaving { opacity: 0; transform: translateY(8px) scale(0.98); transition: opacity var(--aq-t) linear, transform var(--aq-t) var(--aq-ease); }
@keyframes aq-toast-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } }

/* ---------- the key field: the desk's 4 x 10 illuminated keys ----------
 * A key is its lamp: lit, the whole cap takes the colour of its light; dark, it is a neutral cap.
 * Set --led to the colour and --glow to the brightness (0..1). aquillus.js -> ledStyle() does both and
 * picks a legend colour that stays readable on the light (--ink).
 * Keys are a picture of the hardware: the caps are dark in the light theme as well. Put the key field, the
 * faders and the joystick on .aq-desk so they sit on the desk and not on the page. */
.aq-desk {
  background: var(--aq-desk); color: var(--aq-key-ink); border-radius: var(--aq-r-xl); padding: 16px; color-scheme: dark;
  --aq-deck: #1c1c1e; --aq-rail: #2c2c2e; --aq-rail-2: #3a3a3c; --aq-line: #38383a; --aq-hairline: rgba(255, 255, 255, 0.08);
  --aq-text: #f5f5f7; --aq-muted: #98989f; --aq-faint: #636366; --aq-signal: #40c8e0; --aq-on-signal: #00252d;
  --aq-red: #ff453a; --aq-green: #30d158; --aq-amber: #ff9f0a; --aq-red-fill: #ff453a; --aq-green-fill: #30d158; --aq-amber-fill: #ff9f0a;
  --aq-onair-fill: #e0271b; --aq-knob: #ffffff; --aq-thumb: #636366;
}
.aq-keys { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 8px; }
.aq-key {
  --led: transparent;
  --glow: 0;
  --ink: var(--aq-key-ink);
  position: relative; aspect-ratio: 1.15; min-height: 44px; padding: 6px 4px; border: 0; border-radius: 12px;
  background: color-mix(in srgb, var(--led) calc(var(--glow) * 100%), var(--aq-key-cap));
  color: var(--ink); font: 600 var(--aq-fs-sm)/1.12 var(--aq-font); letter-spacing: -0.004em;
  display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden; overflow-wrap: break-word; hyphens: auto;
  cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: none;
  transition: transform var(--aq-t) var(--aq-ease), background-color 120ms linear, color 120ms linear;
}
.aq-key[data-pressed="true"], .aq-key:active { transform: scale(0.95); filter: brightness(1.18); transition-duration: var(--aq-t-press); }
.aq-key[data-selected="true"] { box-shadow: 0 0 0 2px var(--aq-desk), 0 0 0 4px var(--aq-signal); }
.aq-key small { position: absolute; top: 5px; left: 7px; font: 500 10px/1 var(--aq-font); letter-spacing: 0.01em; color: color-mix(in srgb, var(--ink) 55%, transparent); }
/* Blinking the way the desk does it: on, dark, on. paintKey() in aquillus.js animates the real on/off ratio and
   keeps all keys in step; this rule is the plain fallback (even split) for a key marked by hand. Set --on and --off (ms). */
.aq-key[data-blink="true"] { animation: aq-key-blink calc((var(--on, 400) + var(--off, 400)) * 1ms) steps(1, end) infinite; }
@keyframes aq-key-blink { 0% { background: color-mix(in srgb, var(--led) calc(var(--glow) * 100%), var(--aq-key-cap)); color: var(--ink); } 50% { background: var(--aq-key-cap); color: var(--aq-key-ink); } }
.aq-swatch { width: 28px; height: 28px; border-radius: 50%; border: 0; box-shadow: inset 0 0 0 1px var(--aq-hairline); cursor: pointer; padding: 0; transition: transform var(--aq-t) var(--aq-ease); }
.aq-swatch:active { transform: scale(0.9); transition-duration: var(--aq-t-press); }
.aq-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--aq-deck), 0 0 0 4px var(--aq-text); }

/* A fader of the desk: tall, with the knob on a slot. Value through --aq-p (0 at the bottom, 1 at the top). */
.aq-fader { position: relative; width: 44px; height: 168px; touch-action: none; cursor: grab; --aq-p: 0.5; }
.aq-fader::before { content: ""; position: absolute; left: 50%; top: 10px; bottom: 10px; width: 4px; margin-left: -2px; border-radius: 2px; background: linear-gradient(to top, var(--aq-signal) calc(var(--aq-p) * 100%), var(--aq-rail-2) calc(var(--aq-p) * 100%)); }
.aq-fader > i { position: absolute; left: 4px; right: 4px; height: 20px; border-radius: 6px; bottom: calc(var(--aq-p) * (100% - 20px)); background: var(--aq-knob); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 0 0 0.5px rgba(0, 0, 0, 0.1); }
.aq-fader > i::after { content: ""; position: absolute; left: 8px; right: 8px; top: 9px; height: 2px; border-radius: 1px; background: rgba(0, 0, 0, 0.28); }
.aq-fader:active { cursor: grabbing; }

/* ---------- people who asked for less ---------- */
@media (prefers-reduced-motion: reduce) {
  .aq *, .aq *::before, .aq *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  /* A blinking key carries meaning: it stays, as a calm change of state without the hard flash. */
  .aq .aq-key[data-blink="true"] { animation: none; box-shadow: inset 0 0 0 3px var(--aq-key-cap), inset 0 0 0 5px var(--ink); }
  dialog.aq-dialog, dialog.aq-dialog[open] { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .aq-nav, .aq-toolbar, .aq-toast { background: var(--aq-deck); -webkit-backdrop-filter: none; backdrop-filter: none; }
  dialog.aq-dialog::backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --aq-hairline: color-mix(in srgb, var(--aq-text) 46%, transparent); --aq-muted: color-mix(in srgb, var(--aq-text) 82%, var(--aq-ink)); }
  .aq-nav, .aq-toolbar, .aq-toast { background: var(--aq-deck); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .aq-btn, .aq-input, .aq-select, .aq-textarea, .aq-key, .aq-seg, .aq-tabs { box-shadow: inset 0 0 0 1px var(--aq-hairline); }
}
