/* Silent Cartographer
   ------------------------------------------------------------------------
   One stylesheet for the whole console, served under a name that contains a
   hash of its contents so it is fetched once and then never again.

   The look is the map room on Installation 04: a dark chamber, a holographic
   projection in Forerunner cyan, readouts in a HUD's letter-spaced capitals.
   The dark theme is the real one. The light theme is the same room with the
   lights up - it exists because somebody will open this on a phone in the
   sun, not because the map room has a daytime.

   Tokens first, components second. Anything a page wants to look different
   about should be a variable here rather than a style attribute there. */

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

:root {
  color-scheme: dark;

  --bg: #05090f;
  --bg-glow: rgba(64, 196, 255, 0.13);
  --grid: rgba(110, 210, 255, 0.045);
  --surface: #0a121c;
  --raised: #0f1a27;
  --sunken: #060c14;

  --text: #d6eefa;
  --muted: #7d98ab;
  --faint: #4c6475;
  --line: rgba(120, 210, 255, 0.13);
  --line-strong: rgba(120, 210, 255, 0.26);

  /* The projection. */
  --accent: #52d6ff;
  --accent-strong: #9aeeff;
  --accent-text: #021018;
  --accent-weak: rgba(82, 214, 255, 0.1);
  --accent-glow: 0 0 18px rgba(82, 214, 255, 0.35);

  /* Covenant violet, for the things only an admin sees. */
  --violet: #b99bff;
  --violet-weak: rgba(185, 155, 255, 0.12);

  --ok: #5ef2a9;
  --ok-weak: rgba(94, 242, 169, 0.1);
  --warn: #ffc857;
  --warn-weak: rgba(255, 200, 87, 0.1);
  --danger: #ff6b5b;
  --danger-weak: rgba(255, 107, 91, 0.11);

  --font-display: "Rajdhani", "Segoe UI", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r-sm: 4px;
  --r-md: 6px;
  --cut: 10px;

  --bar-h: 60px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;

    --bg: #e9eff3;
    --bg-glow: rgba(0, 150, 200, 0.12);
    --grid: rgba(0, 90, 130, 0.05);
    --surface: #f8fbfc;
    --raised: #ffffff;
    --sunken: #dde6ec;

    --text: #0b1c27;
    --muted: #4d6676;
    --faint: #8aa0ad;
    --line: rgba(10, 70, 100, 0.14);
    --line-strong: rgba(10, 70, 100, 0.28);

    --accent: #0784aa;
    --accent-strong: #045f7c;
    --accent-text: #ffffff;
    --accent-weak: rgba(7, 132, 170, 0.09);
    --accent-glow: 0 0 0 transparent;

    --violet: #6a44c9;
    --violet-weak: rgba(106, 68, 201, 0.09);

    --ok: #0f8a54;
    --ok-weak: rgba(15, 138, 84, 0.1);
    --warn: #9a6400;
    --warn-weak: rgba(154, 100, 0, 0.1);
    --danger: #c7372a;
    --danger-weak: rgba(199, 55, 42, 0.09);
  }
}

/* ------------------------------------------------------------------ base */

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  /* The chamber: a glow where the projection is, and a faint survey grid
     under everything. Both are gradients, so there is nothing to fetch. */
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, var(--bg-glow), transparent 70%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.55 var(--font-body);
}

body.centred {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

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

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0;
  line-height: 1.15;
}

h1 { font-size: 34px; }
h2 { font-size: 20px; text-transform: uppercase; letter-spacing: 0.1em; }
h3 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.12em; }

p { margin: 0 0 16px; color: var(--muted); }

code, .mono { font-family: var(--font-mono); font-size: 13px; }

strong { color: var(--text); }

::selection { background: var(--accent); color: var(--accent-text); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ico { display: inline-block; width: 1.15em; text-align: center; margin-right: 0.45em; }
button.icon-button .ico { margin-right: 0; }

/* With no icon kit configured the body carries no-icons, and every icon is
   dropped in favour of the words beside it - an icon-only button shows its
   word instead. The server knows whether there is a kit, so this is decided
   there rather than guessed at from whether an icon happened to load. */
.no-icons .ico { display: none; }

.kicker {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.faint { color: var(--faint); }
.small { font-size: 13px; }

/* ------------------------------------------------------------------- bar */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--bar-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.bar::after {
  /* The scan line under the bar: brightest in the middle, gone at the ends. */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.55;
}

.bar nav {
  max-width: 1180px;
  height: 100%;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 18px;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand:hover { color: var(--text); text-decoration: none; }

.ring { width: 34px; height: 34px; flex: none; color: var(--accent); filter: drop-shadow(0 0 6px rgba(82, 214, 255, 0.55)); }
.ring.large { width: 76px; height: 76px; }

.tab {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 12px;
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
}

.tab:hover { color: var(--text); text-decoration: none; }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }

.spacer { flex: 1; }

.who {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.who .role {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 11px;
  padding: 1px 6px;
  margin-left: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
}

.bar form { margin: 0; }

/* ---------------------------------------------------------------- layout */

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 16px 80px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.page-head h1 { word-break: break-word; }
.page-head p { margin: 8px 0 0; max-width: 680px; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin: 36px 0 14px;
}

.section-head .count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
}

.section-head .spacer { flex: 1; }

/* ----------------------------------------------------------------- panel */

/* A panel is a readout: a surface with a hairline border and two corner
   brackets, top left and bottom right, the way the map room frames what it
   projects. */
.panel {
  position: relative;
  background: linear-gradient(180deg, var(--raised), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 22px;
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  border-color: var(--accent);
  border-style: solid;
  opacity: 0.8;
}

.panel::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.panel::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

.panel.violet::before, .panel.violet::after { border-color: var(--violet); }
.panel.danger::before, .panel.danger::after { border-color: var(--danger); }

.panel > h2, .panel > h3 { margin-bottom: 6px; }

.narrow { width: 100%; max-width: 440px; }

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

label, .label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

input[type=email], input[type=text], input[type=number], input[type=search], select, textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--sunken);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input.mono, textarea.mono, select.mono { font-family: var(--font-mono); font-size: 13.5px; }

textarea { resize: vertical; min-height: 42px; line-height: 1.5; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak), var(--accent-glow);
}

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

.field { margin-bottom: 16px; }
.hint { margin-top: 6px; font-size: 12.5px; color: var(--faint); }

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

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 10px 18px;
  border: 0;
  border-radius: 0;
  background: var(--accent);
  color: var(--accent-text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  /* The Forerunner cut: two corners taken off. clip-path rather than a
     border so it costs nothing and scales with the button. */
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  transition: background 0.15s, filter 0.15s, transform 0.05s;
}

button:hover, .button:hover { background: var(--accent-strong); text-decoration: none; color: var(--accent-text); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: default; }
button.block { width: 100%; padding: 12px 18px; }

button.ghost, .button.ghost {
  background: transparent;
  color: var(--accent);
  clip-path: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 8px 14px;
}

button.ghost:hover, .button.ghost:hover { background: var(--accent-weak); border-color: var(--accent); color: var(--accent-strong); }

button.danger { background: var(--danger); color: #fff; }
button.danger:hover { background: color-mix(in srgb, var(--danger) 85%, #fff); }
button.ghost.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
button.ghost.danger:hover { background: var(--danger-weak); }

button.link {
  background: none;
  clip-path: none;
  padding: 6px 8px;
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

button.link:hover { color: var(--text); background: none; }

button.icon-button {
  background: transparent;
  clip-path: none;
  color: var(--muted);
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 14px;
  letter-spacing: 0;
}

button.icon-button:hover { background: var(--accent-weak); color: var(--accent); border-color: var(--line); }
button.icon-button.danger { background: transparent; color: var(--muted); }
button.icon-button.danger:hover { background: var(--danger-weak); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

button.icon-button .word { display: none; }
.no-icons button.icon-button { width: auto; padding: 0 8px; }
.no-icons button.icon-button .word { display: inline; font-family: var(--font-body); font-size: 12px; text-transform: none; }

/* --------------------------------------------------------------- banners */

.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  margin-bottom: 18px;
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  background: var(--danger-weak);
  color: var(--danger);
  border-radius: var(--r-sm);
  font-size: 14px;
}

.banner.ok { border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: var(--ok-weak); color: var(--ok); }
.banner.warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-weak); color: var(--warn); }

/* ------------------------------------------------------------- the ring */

/* The front door: one panel in the middle of an otherwise empty chamber. */
.gate { width: 100%; max-width: 440px; text-align: left; }
.gate .ring { display: block; margin: 0 auto 18px; }
.gate h1 { font-size: 28px; text-transform: uppercase; letter-spacing: 0.08em; text-align: center; }
.gate .kicker { text-align: center; }
.gate > p, .gate .lede { text-align: center; }
.gate .lede { margin: 10px 0 22px; }

/* ------------------------------------------------------- installations */

.installations {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}

.installation { display: flex; flex-direction: column; gap: 14px; }

.installation .designation {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
}

.installation h2 {
  font-size: 26px;
  text-transform: none;
  letter-spacing: 0.01em;
  word-break: break-word;
}

.installation h2 a { color: var(--text); }
.installation h2 a:hover { color: var(--accent-strong); text-decoration: none; }
.installation .description { margin: 0; font-size: 14px; }
.installation .foot { display: flex; align-items: center; gap: 10px; margin-top: auto; flex-wrap: wrap; }

.empty {
  padding: 48px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--muted);
}

.empty .ring { margin: 0 auto 14px; display: block; opacity: 0.6; }

/* --------------------------------------------------------------- beacons */

.beacons { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }

.beacon-list { list-style: none; margin: 12px 0 14px; padding: 0; }

.beacon-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
  font-family: var(--font-mono);
  font-size: 14px;
}

.beacon-list li:last-child { border-bottom: 0; }

.beacon-list .n {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--faint);
  width: 22px;
}

.beacon-list .host { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.beacon-list.compact li { padding: 4px 0; font-size: 13px; border: 0; }

/* The link light: is the world actually asking these servers? */
.signal { display: flex; gap: 12px; align-items: flex-start; }
.signal .light {
  flex: none;
  width: 11px;
  height: 11px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--faint);
}

.signal.linked .light { background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: pulse 2.4s ease-in-out infinite; }
.signal.elsewhere .light { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.signal.silent .light, .signal.failed .light { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
.signal.scanning .light { background: var(--accent); animation: pulse 0.9s ease-in-out infinite; }

.signal .state {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.signal.linked .state { color: var(--ok); }
.signal.elsewhere .state { color: var(--warn); }
.signal.silent .state, .signal.failed .state { color: var(--danger); }
.signal.scanning .state { color: var(--accent); }

.signal .detail { margin: 2px 0 0; font-size: 13.5px; }
.signal .found { margin-top: 6px; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }

@keyframes pulse { 50% { opacity: 0.35; } }

@media (prefers-reduced-motion: reduce) {
  .signal .light, .spin { animation: none !important; }
}

/* --------------------------------------------------------------- records */

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .search { flex: 1; min-width: 200px; position: relative; }
.toolbar .search input { padding-left: 34px; }
.toolbar .search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); margin: 0; }
.toolbar kbd { font-family: var(--font-mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: 3px; color: var(--faint); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }

.chip {
  background: transparent;
  clip-path: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  font-weight: 500;
}

.chip:hover { background: var(--accent-weak); color: var(--text); }
.chip.on { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); }

.records { width: 100%; border-collapse: collapse; }

.records th {
  text-align: left;
  padding: 0 12px 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--line-strong);
}

.records td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.records tr.set:hover td { background: var(--accent-weak); }
.records tr.set.flash td { animation: flash 1.6s ease-out; }

@keyframes flash { from { background: color-mix(in srgb, var(--accent) 28%, transparent); } }

.records .name { font-family: var(--font-mono); font-size: 13.5px; font-weight: 500; overflow-wrap: anywhere; min-width: 120px; }
.records .name .zone { color: var(--faint); font-weight: 400; }
.records .ttl { font-family: var(--font-mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
.records .values { font-family: var(--font-mono); font-size: 13px; width: 55%; }
.records .values div { overflow-wrap: anywhere; padding: 1px 0; }
.records .actions { width: 84px; text-align: right; white-space: nowrap; }
.records .actions .lock { color: var(--faint); font-size: 12px; }

.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  border-radius: 3px;
  vertical-align: 1px;
}

.badge.self { color: var(--violet); }

/* Record types each get a colour so a long list can be scanned by eye. */
.type {
  display: inline-block;
  min-width: 52px;
  padding: 2px 7px;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  border-radius: 3px;
  color: var(--t, var(--muted));
  background: color-mix(in srgb, var(--t, var(--muted)) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--t, var(--muted)) 35%, transparent);
}

.type[data-type=A] { --t: #52d6ff; }
.type[data-type=AAAA] { --t: #6f9bff; }
.type[data-type=CNAME] { --t: #b99bff; }
.type[data-type=TXT] { --t: #5ef2a9; }
.type[data-type=MX] { --t: #ffc857; }
.type[data-type=CAA] { --t: #ff8fc8; }
.type[data-type=SRV] { --t: #ff9f5a; }
.type[data-type=NS], .type[data-type=SOA] { --t: #8da4b5; }

@media (prefers-color-scheme: light) {
  .type[data-type=A] { --t: #0784aa; }
  .type[data-type=AAAA] { --t: #2f5fd0; }
  .type[data-type=CNAME] { --t: #6a44c9; }
  .type[data-type=TXT] { --t: #0f8a54; }
  .type[data-type=MX] { --t: #9a6400; }
  .type[data-type=CAA] { --t: #b8307a; }
  .type[data-type=SRV] { --t: #b45309; }
  .type[data-type=NS], .type[data-type=SOA] { --t: #56707f; }
}

.no-match td { text-align: center; color: var(--muted); padding: 28px; }

/* ---------------------------------------------------------------- editor */

/* The same editor adds a record at the top of the list and edits one in
   place inside it: name, type, ttl, values, and the two buttons. */
.editor {
  display: grid;
  grid-template-columns: minmax(140px, 1.1fr) 110px 110px minmax(220px, 2.4fr) auto;
  gap: 10px;
  align-items: start;
}

.editor .field { margin: 0; }
.editor .buttons { display: flex; gap: 8px; padding-top: 22px; }
.editor .suffix { position: relative; }
.editor .suffix input { padding-right: 12px; }
.editor .help { grid-column: 1 / -1; margin-top: -2px; font-size: 12.5px; color: var(--faint); }
.editor .help .warn { color: var(--warn); }

/* The values: a chip for each, and the line for the next one after them,
   all inside what looks like one input. */
.values-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-height: 42px;
  padding: 5px;
  background: var(--sunken);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  cursor: text;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.values-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak), var(--accent-glow);
}

.values-box input[type=text] {
  flex: 1 1 140px;
  min-width: 140px;
  width: auto;
  padding: 5px 6px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.values-box .value {
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
  background: var(--accent-weak);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.4;
}

.values-box .value button {
  background: none;
  clip-path: none;
  color: var(--text);
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
}

.values-box .value button:hover { background: var(--accent-weak); color: var(--accent-strong); }
.values-box .value button:active { transform: none; }
.values-box .value .text { padding: 4px 4px 4px 8px; text-align: left; white-space: normal; overflow-wrap: anywhere; cursor: text; }
.values-box .value .remove { padding: 0 7px; color: var(--muted); border-left: 1px solid var(--line); }
.values-box .value .remove:hover { color: var(--danger); background: var(--danger-weak); }
.values-box .value .remove .ico { margin: 0; font-size: 11px; }
.values-box .value.again { animation: again 0.6s; }

@keyframes again {
  0%, 100% { border-color: var(--line-strong); }
  30% { border-color: var(--warn); background: var(--warn-weak); }
}

tr.editing td { background: var(--accent-weak); padding: 14px 12px; border-bottom-color: var(--accent); }

.confirm { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--danger); }
.confirm button { padding: 4px 10px; font-size: 12px; }

/* --------------------------------------------------------------- history */

details.log > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

details.log > summary::-webkit-details-marker { display: none; }
details.log > summary::after { content: "+"; font-family: var(--font-mono); color: var(--accent); margin-left: auto; font-size: 18px; }
details.log[open] > summary::after { content: "\2212"; }

.entries { list-style: none; margin: 16px 0 0; padding: 0; }
.entries > li { padding: 12px 0; border-top: 1px solid var(--line); }
.entries .meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.entries .meta .author { color: var(--text); }
.entries .diff { font-family: var(--font-mono); font-size: 12.5px; }
.entries .diff div { overflow-wrap: anywhere; padding: 1px 0; }
.entries .add { color: var(--ok); }
.entries .del { color: var(--danger); }

/* ----------------------------------------------------------------- toast */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
}

.toast {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-size: 14px;
  animation: slide 0.18s ease-out;
}

.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
.toast .title { font-family: var(--font-display); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; font-size: 13px; }
.toast.ok .title { color: var(--ok); }
.toast.error .title { color: var(--danger); }
.toast .body { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

@keyframes slide { from { transform: translateY(8px); opacity: 0; } }

.spin {
  width: 16px;
  height: 16px;
  flex: none;
  border: 2px solid var(--accent-weak);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------------- users */

.people { width: 100%; border-collapse: collapse; }
.people th { text-align: left; padding: 0 12px 10px; font-family: var(--font-display); font-weight: 600; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint); border-bottom: 1px solid var(--line-strong); }
.people td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.people select { width: auto; padding: 6px 10px; }
.people input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--danger); }

.invite { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr) auto; gap: 12px; align-items: end; }
.invite .field { margin: 0; }

.scroll { overflow-x: auto; }

/* ------------------------------------------------------------ small screens */

@media (max-width: 900px) {
  .beacons { grid-template-columns: 1fr; }
  .editor { grid-template-columns: 1fr 1fr; }
  .editor .values-field, .editor .name-field { grid-column: 1 / -1; }
  .editor .buttons { grid-column: 1 / -1; padding-top: 0; }
}

@media (max-width: 720px) {
  h1 { font-size: 27px; }
  .page { padding-top: 24px; }
  .bar nav { gap: 2px; }
  .brand { margin-right: 8px; }
  .brand .word { display: none; }
  .tab { padding: 0 8px; font-size: 13px; letter-spacing: 0.08em; }
  .who { display: none; }
  .installations { grid-template-columns: 1fr; }
  .invite { grid-template-columns: 1fr; }

  /* The record table becomes a stack of cards: a table that scrolls
     sideways on a phone hides exactly the column that matters. */
  .records thead { display: none; }
  .records, .records tbody, .records tr, .records td { display: block; width: 100%; }
  .records tr.set { position: relative; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .records tr.set td { border: 0; padding: 2px 4px; }
  .records tr.set .name { padding-right: 90px; }
  .records tr.set .type-cell, .records tr.set .ttl { display: inline-block; width: auto; margin-right: 8px; }
  .records tr.set .values { width: 100%; margin-top: 4px; }
  .records tr.set .actions { position: absolute; top: 10px; right: 0; width: auto; }
  tr.editing td { padding: 14px 10px; }
}
