:root {
  --ground: #f1f1ee;
  --card: #ffffff;
  --ink: #15171a;
  --muted: #5b6066;
  --line: #c9c9c3;
  --hairline: #e4e4df;
  --warn: #8a4b00;
  --warn-soft: #f3e3d0;
  --good: #0b6b57;
  --good-soft: #d9efe8;
  --blue: #2b4bee;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: var(--ink);
}

a:hover {
  color: var(--blue);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

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

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
}

h1 {
  font-size: 34px;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 20px;
}

h3 {
  font-family: inherit;
  font-size: 14px;
}

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

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.caps {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.loading {
  padding: 48px;
  text-align: center;
  color: var(--muted);
}

/* Layout: a side menu that stacks above the content in a narrow window. */

.shell {
  display: flex;
  flex-wrap: wrap;
  min-height: 100vh;
}

.nav {
  flex: 1 1 208px;
  max-width: 100%;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 20px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ink);
}

.brand-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
}

.nav a.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  font-weight: 500;
  text-decoration: none;
}

.nav a.item[aria-current="page"] {
  background: var(--card);
  font-weight: 600;
}

.nav .count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.nav .count.alert {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--warn);
  color: #fff;
}

.nav .who {
  margin-top: 20px;
  padding: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.linkish {
  padding: 0;
  border: 0;
  background: none;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.main {
  flex: 999 1 560px;
  min-width: 0;
  padding: 24px 32px 48px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.head h1 {
  flex: 1 1 auto;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
}

.wide {
  flex: 3 1 560px;
  min-width: 0;
}

.side {
  flex: 2 1 340px;
  min-width: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  padding: 20px;
  border-radius: 16px;
  background: var(--card);
}

.card > h2 {
  margin-bottom: 10px;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin-bottom: 10px;
}

.card-head h2 {
  flex: 1 1 auto;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.tile {
  padding: 16px;
  border-radius: 16px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tile .value {
  font-family: var(--display);
  font-weight: 600;
  font-size: 32px;
  letter-spacing: -0.02em;
}

/* Controls */

.btn {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.btn.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}

.btn.danger {
  border-color: var(--warn);
  color: var(--warn);
  font-weight: 600;
}

.btn.round {
  border-radius: 999px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions .btn {
  flex: 1 1 140px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}

.field {
  flex: 0 1 160px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.field.grow {
  flex: 1 1 240px;
}

.field input,
.field select,
.field textarea {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 14px;
  color: var(--ink);
}

.field textarea {
  padding: 10px 12px;
  resize: vertical;
}

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

.chip {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-weight: 500;
}

.chip[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--ground);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.tag.official {
  background: var(--ink);
  color: #fff;
}

.tag.tested {
  background: var(--good-soft);
  color: #0a5445;
}

.tag.warn {
  background: var(--warn-soft);
  color: #7a4200;
}

.tag.blue {
  background: #dde4fd;
  color: #1e36b0;
}

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

/* Tables scroll inside their own box in a narrow window. */

.table-box {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
}

th:first-child,
td:first-child {
  padding-left: 0;
}

thead th {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

tbody tr {
  border-top: 1px solid var(--hairline);
}

tbody tr.picked {
  background: var(--ground);
}

tbody th {
  font-weight: 500;
}

td.small {
  white-space: nowrap;
}

.num {
  text-align: right;
  font-family: var(--mono);
}

.bad {
  color: var(--warn);
  font-weight: 600;
}

.table-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 13px;
}

.table-foot span {
  flex: 1 1 auto;
}

/* Bars */

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 13px;
}

.bar-row .name {
  flex: 0 0 116px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-row .amount {
  flex: 0 0 64px;
  text-align: right;
  font-family: var(--mono);
}

.bar {
  flex: 1 1 auto;
  height: 8px;
  border-radius: 4px;
  background: var(--hairline);
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--ink);
}

.bar > span.good {
  background: var(--good);
}

.bar > span.warn {
  background: var(--warn);
}

.chart {
  height: 180px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  border-bottom: 1px solid var(--line);
}

.chart .day {
  flex: 1 1 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  gap: 1px;
}

.chart .day span {
  flex: 1 1 0;
  min-height: 0;
  border-radius: 3px 3px 0 0;
}

.chart-axis {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 13px;
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 3px;
}

.split {
  display: flex;
  height: 10px;
  gap: 2px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--hairline);
}

/* Lists */

.list > * {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 9px 0;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
}

.list .time {
  flex: 0 0 108px;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.list .kind {
  flex: 0 0 92px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.list .what {
  flex: 1 1 220px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.attention a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 6px 0;
  border-top: 1px solid var(--hairline);
  text-decoration: none;
}

.attention .n {
  flex: none;
  min-width: 36px;
  padding: 4px 6px;
  border-radius: 8px;
  background: var(--ground);
  text-align: center;
  font-family: var(--mono);
  font-weight: 500;
}

.attention .n.hot {
  background: var(--warn-soft);
  color: #7a4200;
}

dl.facts {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  font-size: 13px;
}

dl.facts dt {
  color: var(--muted);
}

dl.facts dd {
  margin: 0;
  text-align: right;
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

blockquote {
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--ground);
  overflow-wrap: anywhere;
}

.notice {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--warn-soft);
  color: #5c3200;
  font-weight: 500;
}

.person {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.avatar {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--hairline);
  object-fit: cover;
}

.avatar.big {
  width: 56px;
  height: 56px;
}

.change {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
}

.change .dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.change .name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.empty {
  padding: 28px 0;
  text-align: center;
  color: var(--muted);
}

/* Sign-in */

.gate {
  min-height: 100vh;
  padding: 48px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate .card {
  flex: 0 1 420px;
  padding: 32px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.gate h1 {
  font-size: 32px;
  line-height: 1.1;
}

.code {
  padding: 16px;
  border-radius: 14px;
  background: var(--ground);
  text-align: center;
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 0.08em;
  user-select: all;
}

.btn.tall {
  min-height: 52px;
  border-radius: 14px;
  font-size: 16px;
}

dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 24px;
  border: 0;
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(21, 23, 26, 0.45);
}

dialog form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 500;
}

@media (max-width: 700px) {
  .main {
    padding: 8px 16px 40px;
  }

  .nav {
    padding-bottom: 8px;
  }

  h1 {
    font-size: 28px;
  }
}
