:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #dde1e6;
  --text: #1c2026;
  --muted: #6b7380;
  --accent: #2f6fde;
  --accent-text: #ffffff;
  --danger: #c93b3b;
  --success-bg: #e5f5ea;
  --success-text: #1d6b37;
  --error-bg: #fbe9e9;
  --error-text: #9b2c2c;
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1c2027;
    --border: #2e343d;
    --text: #e3e6ea;
    --muted: #8d95a1;
    --accent: #5b8ff0;
    --danger: #e06363;
    --success-bg: #183324;
    --success-text: #8fd7a6;
    --error-bg: #3a1d1f;
    --error-text: #f0a3a3;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 650; font-size: 16px; color: var(--text); }
.logout { display: flex; align-items: center; gap: 10px; margin: 0; }

.container { max-width: 1400px; margin: 0 auto; padding: 24px; }
.narrow { max-width: 380px; padding-top: 12vh; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card h1 { margin: 0 0 16px; font-size: 20px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }

input {
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; }
.flash-success { background: var(--success-bg); color: var(--success-text); }
.flash-error { background: var(--error-bg); color: var(--error-text); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-value { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

.search { display: flex; gap: 8px; margin-bottom: 16px; }
.search input { flex: 1; max-width: 520px; }

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }

.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.filename { font-weight: 550; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.build-id { user-select: all; font: 12px/1.45 ui-monospace, "Cascadia Mono", Consolas, monospace; }

/* Visually truncated; clicking selects the whole hash so copy gets all 64 chars. */
.hash {
  display: inline-block;
  max-width: 13ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  user-select: all;
  font: 12px/1.45 ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.actions { display: flex; gap: 6px; justify-content: flex-end; }
.actions form { margin: 0; }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; }
.empty { color: var(--muted); text-align: center; padding: 48px 0; }
