/* The arena window. Phone first: the top bar with the arenas, the sections as a strip under it, one column of cards;
   from 960px the sections stand in a rail on the left. An arena is known by its colour everywhere (/arena.css sets
   --arena for .ar-<code> from the window's base); figures use tabular digits so columns of money line up. */
:root {
  --bg: #f3f5f8; --card: #ffffff; --ink: #14171c; --muted: #5b6370; --line: #dde2e8; --soft: #eef1f5;
  --accent: #1f4e8c; --accent-ink: #ffffff;
  --ok: #2f6f62; --ok-bg: #e5f1ed; --warn: #9a5b00; --warn-bg: #fbf0dd; --bad: #a33a2c; --bad-bg: #f9e7e4;
  --arena: #6b7280;
  --r: 10px; --r-s: 7px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101317; --card: #181c21; --ink: #e6e9ee; --muted: #9aa3af; --line: #2a3038; --soft: #20252c;
    --accent: #8fb6ec; --accent-ink: #0d1726;
    --ok: #7cc4b3; --ok-bg: #1d2c28; --warn: #f0b45c; --warn-bg: #31271a; --bad: #f09a8c; --bad-bg: #37211d;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-underline-offset: 2px; }
h1 { font-size: 26px; line-height: 1.2; margin: 4px 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 19px; line-height: 1.3; margin: 28px 0 10px; }
h3 { font-size: 16px; margin: 0 0 6px; }
.card h2 { margin-top: 0; }
p { margin: 8px 0; }
.muted, .where { color: var(--muted); }
.where { margin: 0 0 16px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* the top bar */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; margin-right: auto; }
.me { color: var(--muted); text-decoration: none; font-size: 14px; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arenas { order: 3; flex-basis: 100%; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.arenas::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 34px; padding: 5px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink);
  font-size: 14px; text-decoration: none; white-space: nowrap; cursor: pointer; list-style: none;
}
.chip::-webkit-details-marker { display: none; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--card); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--arena); flex: none; }

/* sections: a strip on the phone, a rail on a computer */
.frame { max-width: 1240px; margin: 0 auto; }
.modules {
  display: flex; gap: 2px; overflow-x: auto; padding: 8px 12px; scrollbar-width: none;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.modules::-webkit-scrollbar { display: none; }
.modules a {
  flex: none; padding: 7px 10px; border-radius: var(--r-s); color: var(--muted); text-decoration: none; font-size: 15px;
  white-space: nowrap;
}
.modules a.on { color: var(--ink); background: var(--soft); font-weight: 600; }
main { padding: 18px 16px 64px; min-width: 0; }

@media (min-width: 960px) {
  .top { flex-wrap: nowrap; padding: 12px 24px; }
  .arenas { order: 0; flex-basis: auto; }
  .frame { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 0 28px; padding: 0 24px; }
  .modules {
    position: sticky; top: 59px; align-self: start; flex-direction: column; gap: 1px; padding: 18px 0;
    background: none; border: 0; overflow: visible;
  }
  .modules a { padding: 7px 12px; }
  main { padding: 22px 0 80px; }
  h1 { font-size: 28px; }
}

/* the period switch */
.period { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 16px; }
.custom { display: contents; }
.custom .span { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex-basis: 100%; padding: 4px 0; }
.custom label { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); }
.custom input { width: auto; }

/* cards and rows */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin: 12px 0; }
.card.empty p:first-child { font-size: 17px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid .card { margin: 0; }
.arena { border-left: 4px solid var(--arena); }
.arena h3 { display: flex; align-items: center; gap: 8px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows li > span:last-child { text-align: right; overflow-wrap: anywhere; }
.tag { display: inline-block; font-size: 12.5px; padding: 1px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.alert { background: var(--bad-bg); color: var(--bad); border-radius: var(--r-s); padding: 9px 12px; margin: 10px 0; }
.people { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.people .card { margin: 0; }
.person .head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.person .head h3 { margin: 0; }
.person.off { opacity: .7; }
.invite { border-color: var(--accent); }
.copy { display: flex; gap: 8px; }
.copy input { flex: 1; min-width: 0; font-size: 14px; }

/* figures: a sum is one unbreakable piece; a fold opens a list under its line */
.num { white-space: nowrap; }
.big { font-size: 30px; line-height: 1.15; font-weight: 700; margin: 6px 0 0; letter-spacing: -0.01em; }
.small { font-size: 14px; }
h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 4px; }
.note { background: var(--warn-bg); color: var(--warn); border-radius: var(--r-s); padding: 9px 12px; margin: 0 0 14px; font-size: 15px; }
details.fold { margin: 8px 0 0; }
details.fold > summary { cursor: pointer; color: var(--accent); font-size: 15px; padding: 4px 0; }
details.fold > summary .tag { margin-right: 4px; }
.list { list-style: none; margin: 4px 0 0; padding: 0; }
.list li { padding: 7px 0; border-top: 1px solid var(--line); font-size: 15px; overflow-wrap: anywhere; }
.list li:first-child { border-top: 0; }
.list .muted { font-size: 14px; }
.card.day h3 { margin-bottom: 4px; }
.split { display: grid; gap: 4px 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.part { border-left: 3px solid var(--arena); padding-left: 10px; min-width: 0; }
.part .sum { margin: 6px 0 0; }
.part .sum .dot { display: inline-block; margin-right: 6px; vertical-align: 1px; }

/* forms */
form.stack { display: grid; gap: 12px; max-width: 420px; }
label { display: grid; gap: 4px; font-size: 15px; }
label.check { display: flex; gap: 8px; align-items: center; }
input, select {
  font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-s);
  padding: 9px 11px; min-height: 42px; width: 100%;
}
select {
  -webkit-appearance: none; appearance: none; padding-right: 34px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%237b8494' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center;
}
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
legend { font-size: 15px; padding: 0; margin-bottom: 4px; }
button {
  font: inherit; font-weight: 600; min-height: 42px; padding: 8px 16px; border-radius: var(--r-s); cursor: pointer;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
}
button.quiet { background: var(--card); color: var(--ink); border-color: var(--line); font-weight: 500; }
button.danger { color: var(--bad); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.actions form { margin: 0; }
form.access { display: grid; gap: 8px; margin-top: 8px; }
form.access fieldset { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
form.access button { justify-self: start; }

/* the pages without the window around them: the way in, a message */
body.solo { display: grid; min-height: 100vh; place-items: start center; }
main.solo { width: min(440px, 100%); padding: 48px 16px; }
main.solo .brand { color: var(--muted); font-weight: 600; margin-bottom: 18px; }
main.solo h1 { margin-bottom: 16px; }
