/* Arbiter site. Tokens from 2pc plugin/receiver-cpp/src/style.hpp, geometry from
   src/layout.hpp, tab strip and press ripple from src/widgets.cpp
   (pill_tab / draw_ripple): 0.4 s, 15% peak alpha, radius to the farthest
   corner, growing as sqrt(t). Near-black window, top bar with the mark and a
   centred tab strip, cards with a hairline border and a caption header,
   label/value rows, dark buttons with light text, status strip at the bottom.
   Flat: no shadows, no gradients, no transitions, no external requests. */

:root {
  --window-bg: #08080A;
  --card: #0F0F12;
  --card-sunken: #0B0B0E;
  --card-border: #1A1A1F;
  --card-border-hover: #26262E;
  --pill-active: #1C1C22;
  --button: #1A1A20;
  --button-hover: #22222A;
  --button-press: #16161C;
  --scroll-thumb: #33333D;
  --divider: #1A1A1F;

  --text: #E6E6EA;
  --text-secondary: #8A8A96;
  --text-caption: #6B6B75;

  --accent: #3B82F6;
  --accent-hover: #4C8FF8;
  --ok: #5FBF7F;
  --bad: #E0574F;

  --r-card: 8px;
  --r-control: 6px;
  --r-thumb: 4px;

  --row: 38px;
  --card-pad: 14px;
  --card-gap: 10px;
  --caption-h: 24px;
  --top-bar: 46px;
  --tab-h: 36px;
  --status-bar: 28px;
  --content-w: 1020px;
  --max-w: 1180px;

  --mono: "Consolas", "Cascadia Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--window-bg);
  color: var(--text);
  font: 14px/1.45 Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--window-bg); }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: var(--r-thumb); }

/* --- the window ----------------------------------------------------------- */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: var(--max-w);
  margin: 0 auto;
  border-left: 1px solid var(--card-border);
  border-right: 1px solid var(--card-border);
}

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

.topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--top-bar);
  padding: 0 8px;
  border-bottom: 1px solid var(--divider);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  flex: 0 0 auto;
}

.mark { width: 15px; height: 15px; color: var(--text); }

.brand-name {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--text);
}

.tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  height: var(--tab-h);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--r-control);
  overflow: hidden;
}

.tab:hover {
  color: var(--text);
  background: rgba(230, 230, 234, .05);
}

.tab:active { background: rgba(230, 230, 234, .07); }

.tab.active { color: var(--text); background: var(--pill-active); }

.tab.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 5px;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
}

.topbar-form { margin: 0; display: flex; }

.topbar-control {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  padding: 0;
  font-size: 12px;
  color: var(--text-caption);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  cursor: pointer;
}

.topbar-control:hover { color: var(--text); background: var(--button-hover); }
.topbar-control:active { background: var(--button-press); }

/* --- page column ---------------------------------------------------------- */

.main {
  display: flex;
  flex-direction: column;
  gap: var(--card-gap);
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 16px 12px;
}

.page-head { padding: 0 2px 2px; }

.page-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--text);
}

.page-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

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

.group {
  padding: var(--card-pad);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r-card);
}

.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: var(--caption-h);
  margin: calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad)) 12px;
  padding: 0 var(--card-pad);
  border-bottom: 1px solid var(--divider);
}

.group-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-caption);
}

/* --- status pill ---------------------------------------------------------- */

.pill {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-caption);
}

.pill.ok { color: var(--ok); }
.pill.warn { color: var(--bad); }

/* --- label/value rows ----------------------------------------------------- */

.facts { margin: 0; }

.fact {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  min-height: 26px;
}

.fact dt {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.fact dd {
  margin: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: right;
  overflow-wrap: anywhere;
}

.mono { font-family: var(--mono); font-size: 12px; }

/* --- build chart ---------------------------------------------------------- */

table.chart {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

table.chart th {
  height: var(--caption-h);
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: left;
  color: var(--text-caption);
  border-bottom: 1px solid var(--divider);
}

table.chart td {
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

table.chart tbody tr:hover td { background: #131318; }

table.chart th:nth-child(1), table.chart td:nth-child(1) { width: 15%; }
table.chart th:nth-child(2), table.chart td:nth-child(2) { width: auto; }
table.chart th:nth-child(3), table.chart td:nth-child(3) { width: 90px; text-align: right; }
table.chart th:nth-child(4), table.chart td:nth-child(4) { width: 170px; text-align: right; }

.branch {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.branch.release { color: var(--text); }
.branch.dev { color: var(--accent-hover); }
.branch.retired { color: var(--text-caption); }

a.build {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  padding: 2px 0;
}

a.build:hover { color: var(--accent-hover); }

.size { color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; }

.updated { color: var(--text-secondary); font-size: 12px; }

h3.section {
  margin: 2px 0 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-caption);
}

/* --- text ----------------------------------------------------------------- */

h1 { margin: 0 0 8px; font-size: 16px; font-weight: 600; letter-spacing: .01em; }

h2 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }

h3 { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--text); }

p.lead { margin: 0; font-size: 13px; color: var(--text-secondary); }

code { font-family: var(--mono); font-size: 12px; color: var(--text-secondary); }

.empty { padding: 12px; font-size: 12px; color: var(--text-caption); }

.hint { margin: 12px 0 0; font-size: 11px; color: var(--text-caption); }

.error { margin-top: 12px; font-size: 12px; color: var(--bad); }

/* --- grids and nested cards ----------------------------------------------- */

.grid {
  display: grid;
  gap: var(--card-gap);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid + .grid { margin-top: var(--card-gap); }

p.lead + .grid { margin-top: 12px; }

.card {
  padding: 12px;
  background: var(--card-sunken);
  border: 1px solid var(--card-border);
  border-radius: var(--r-control);
}

.card p { margin: 0; font-size: 12px; color: var(--text-secondary); }

.shot {
  display: grid;
  place-items: center;
  height: 180px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-caption);
  background: var(--card-sunken);
  border: 1px solid var(--card-border);
  border-radius: var(--r-control);
}

.shot.wide { height: 240px; }

/* --- controls ------------------------------------------------------------- */

label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--card-sunken);
  border: 1px solid var(--card-border);
  border-radius: var(--r-control);
}

input::placeholder { color: var(--text-caption); }

input:focus { outline: none; border-color: var(--accent); }

button {
  position: relative;
  width: 100%;
  height: 40px;
  padding: 0 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--button);
  border: 1px solid transparent;
  border-radius: var(--r-control);
  overflow: hidden;
  cursor: pointer;
}

button:hover { background: var(--button-hover); }
button:active { background: var(--button-press); }

button.plain {
  width: 100%;
  height: 34px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--card-border);
}

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

form.login { max-width: 320px; margin: 0; }
form.login button { margin-top: 14px; }

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

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--status-bar);
  padding: 0 12px;
  font-size: 11px;
  color: var(--text-caption);
  border-top: 1px solid var(--divider);
}

/* --- press ripple --------------------------------------------------------- */

[data-ripple] { position: relative; overflow: hidden; }

.ripple {
  position: absolute;
  left: calc(var(--rx) - var(--rr));
  top: calc(var(--ry) - var(--rr));
  width: calc(var(--rr) * 2);
  height: calc(var(--rr) * 2);
  border-radius: 50%;
  background: var(--text);
  pointer-events: none;
  transform: scale(0);
  opacity: 0;
  animation: ripple 400ms linear forwards;
}

@keyframes ripple {
  0%   { transform: scale(0);   opacity: .15; }
  25%  { transform: scale(.5);  opacity: .11; }
  50%  { transform: scale(.71); opacity: .06; }
  75%  { transform: scale(.87); opacity: .024; }
  100% { transform: scale(1);   opacity: 0; }
}

@media (max-width: 720px) {
  .brand-name { display: none; }
  .tab { padding: 0 8px; font-size: 12px; }
  .tab.active::after { left: 8px; right: 8px; }
  table.chart th:nth-child(3), table.chart td:nth-child(3) { display: none; }
}
