/* PM Documents
 *
 * A working panel, not a website. It is opened at a desk an hour before
 * kick-off, used quickly, and closed — so density beats whitespace, the state
 * of a fixture is readable at a glance, and the thing you came to do is never
 * more than one click from the page you land on.
 *
 * Light by default. This is a forms-and-tables tool used under office light,
 * and dark panels with glowing accents look like a product demo rather than
 * something that files paperwork. It follows the system into dark anyway, for
 * the press box at ten at night.
 */

:root {
  --paper:   #fbfaf8;
  --surface: #ffffff;
  --sunken:  #f4f2ee;
  --line:    #e2ded6;
  --line-strong: #cdc7bb;

  --ink:     #1b1a17;
  --ink-2:   #4a463f;
  --muted:   #7d7669;

  /* Ink and a signal colour, rather than a generic interface blue. */
  --accent:  #9a3412;
  --accent-soft: #fdf0e8;

  --ok:      #2f6a3f;
  --ok-soft: #eaf3ec;
  --warn:    #8a5a00;
  --warn-soft: #fbf2df;
  --bad:     #a4282c;
  --bad-soft: #fbecec;

  --radius: 8px;
  --rail: 15rem;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:   #16151a;
    --surface: #1d1c22;
    --sunken:  #121116;
    --line:    #2e2c35;
    --line-strong: #413e4a;

    --ink:     #f0eef2;
    --ink-2:   #c6c2cc;
    --muted:   #8e8896;

    --accent:  #f0854c;
    --accent-soft: #33211a;

    --ok:      #6ec98a;   --ok-soft:   #16261b;
    --warn:    #e0aa4a;   --warn-soft: #2a2114;
    --bad:     #f2777c;   --bad-soft:  #2c1718;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

h1 { font-size: 1.25rem; font-weight: 650; letter-spacing: -.015em; margin: 0; }
h2 { font-size: .95rem; font-weight: 650; margin: 1.75rem 0 .6rem; }
h2:first-child { margin-top: 0; }

.muted { color: var(--muted); }
.small { font-size: .85em; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ shell */

/* A rail rather than a row of links. Eleven items across the top is a list of
   everything the program can do; down the side, grouped, it is a place to work
   — what you do today at the top, the things you set up once underneath. */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }

.rail {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 1rem .75rem;
  display: flex; flex-direction: column; gap: 1.25rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}

.rail__brand {
  display: flex; align-items: baseline; gap: .45rem;
  padding: .1rem .5rem .3rem;
  font-weight: 680; letter-spacing: -.02em; font-size: 1rem;
  color: var(--ink); text-decoration: none;
}
.rail__brand span { font-size: .7rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }

.rail__group { display: grid; gap: 1px; }
.rail__label {
  font-size: .68rem; font-weight: 650; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); padding: 0 .5rem .3rem;
}

.rail a.nav {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .42rem .5rem;
  border-radius: 6px;
  color: var(--ink-2); text-decoration: none;
  font-weight: 500;
}
.rail a.nav:hover { background: var(--sunken); color: var(--ink); }
.rail a.nav.is-on { background: var(--accent-soft); color: var(--accent); font-weight: 620; }

.rail__foot { margin-top: auto; padding: .5rem; font-size: .8rem; color: var(--muted); }

.content { padding: 1.4rem 1.8rem 5rem; min-width: 0; }

/* Tables and the dashboard use the whole width — on a wide screen a capped
   column leaves the page looking like it stopped halfway. Forms are capped
   instead, and only forms, because a text field two feet wide is unreadable. */
.content > form.stack,
.content > .panel > form.stack { max-width: 58rem; }

/* One bar at the top of every screen: what you are looking at, and the single
   thing you are most likely to want to do to it. */
.page {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem;
}
.page__title { display: grid; gap: .15rem; min-width: 0; }
.page__actions { display: flex; gap: .5rem; flex-wrap: wrap; }

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

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.panel--flush { padding: 0; overflow: hidden; }

/* ------------------------------------------------------------------ table */

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

table.list { width: 100%; border-collapse: collapse; }

table.list th {
  text-align: left; font-size: .7rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: .6rem .85rem; border-bottom: 1px solid var(--line);
  background: var(--sunken);
  position: sticky; top: 0; z-index: 1;
}
table.list td { padding: .6rem .85rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover { background: var(--sunken); }

.fixture { font-weight: 600; letter-spacing: -.01em; }

/* Row actions stay quiet until the row is under the pointer, so a long list
   reads as data rather than as a wall of buttons. */
.row-actions { display: flex; gap: .35rem; justify-content: flex-end; opacity: .35; transition: opacity .12s; }
tr:hover .row-actions, .row-actions:focus-within { opacity: 1; }

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

.pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .15rem .5rem; border-radius: 99px;
  font-size: .72rem; font-weight: 620; letter-spacing: .01em;
  background: var(--sunken); color: var(--ink-2);
  white-space: nowrap;
}
.pill--ok   { background: var(--ok-soft);   color: var(--ok); }
.pill--warn { background: var(--warn-soft); color: var(--warn); }
.pill--bad  { background: var(--bad-soft);  color: var(--bad); }
.pill--dot::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: currentColor; }

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

.stack { display: flex; flex-direction: column; gap: .85rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; }
.row > label { flex: 1 1 12rem; min-width: 0; }

label {
  display: flex; flex-direction: column; gap: .25rem;
  font-size: .76rem; font-weight: 600; color: var(--muted);
  letter-spacing: .01em;
}

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 6px;
  padding: .42rem .55rem; width: 100%;
  font-weight: 400;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent;
}
input[disabled], select[disabled] { background: var(--sunken); color: var(--muted); }
textarea { font-family: var(--mono); font-size: .82rem; line-height: 1.5; resize: vertical; }

.hint { font-size: .78rem; color: var(--muted); margin: -.3rem 0 0; max-width: 52rem; }

.actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding-top: .3rem; }

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

.btn, button {
  font: inherit; font-weight: 600; font-size: .84rem;
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .42rem .8rem; border-radius: 6px; cursor: pointer;
  border: 1px solid transparent;
  background: var(--accent); color: #fff;
  text-decoration: none; white-space: nowrap;
}
.btn:hover, button:hover { filter: brightness(1.07); text-decoration: none; }

.btn--quiet, button.quiet {
  background: var(--surface); color: var(--ink); border-color: var(--line-strong);
}
.btn--quiet:hover, button.quiet:hover { background: var(--sunken); filter: none; }

.btn--small { padding: .25rem .55rem; font-size: .78rem; }
button[disabled], .btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }

/* ----------------------------------------------------------------- flash */

.flash {
  padding: .6rem .85rem; border-radius: 6px; margin: 0 0 1rem;
  border: 1px solid var(--line); background: var(--surface);
  font-size: .88rem;
}
.flash.ok    { background: var(--ok-soft);   border-color: color-mix(in srgb, var(--ok) 35%, transparent);   color: var(--ok); }
.flash.warn  { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); }
.flash.error { background: var(--bad-soft);  border-color: color-mix(in srgb, var(--bad) 35%, transparent);  color: var(--bad); }

/* ------------------------------------------------------------ file viewer */

/* The generated files are the product, so they get shown properly: tabs, a
   monospace body with visible tabs, and a copy button — because the day
   Dropbox refuses, pasting the text by hand is the way the match still gets
   captioned. */
.files { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }

.files__tabs { display: flex; gap: 2px; padding: .35rem .35rem 0; background: var(--sunken); border-bottom: 1px solid var(--line); overflow-x: auto; }
.files__tab {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: .8rem; font-weight: 600;
  padding: .45rem .8rem; border-radius: 6px 6px 0 0; cursor: pointer; white-space: nowrap;
}
.files__tab:hover { color: var(--ink); background: color-mix(in srgb, var(--surface) 60%, transparent); filter: none; }
.files__tab.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 0 var(--surface); }

.files__body { position: relative; }
.files__copy { position: absolute; top: .55rem; right: .55rem; z-index: 2; }

.files pre {
  margin: 0; padding: .9rem 1rem; overflow-x: auto;
  font-family: var(--mono); font-size: .8rem; line-height: 1.6;
  tab-size: 12;          /* the team files are tab-separated; make columns line up */
  -moz-tab-size: 12;
  color: var(--ink);
}

.files__meta { padding: .5rem .85rem; border-top: 1px solid var(--line); background: var(--sunken); font-size: .76rem; color: var(--muted); }

/* ----------------------------------------------------------------- misc */

.empty {
  text-align: center; color: var(--muted);
  padding: 3rem 1.5rem; border: 1px dashed var(--line-strong); border-radius: var(--radius);
}
.empty strong { display: block; color: var(--ink); margin-bottom: .3rem; }

code {
  font-family: var(--mono); font-size: .84em;
  background: var(--sunken); border: 1px solid var(--line);
  border-radius: 4px; padding: .08em .3em;
}

.players input { padding: .3rem .45rem; font-size: .84rem; }
.players td { padding: .15rem .2rem; border: 0; }
.players th { background: transparent; position: static; }

.signin { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; }
.signin form { display: flex; flex-direction: column; gap: .85rem; margin-top: 1.2rem; }
.signin .panel { width: min(100%, 21rem); margin: 0; }

/* --------------------------------------------------------------- narrow */

@media (max-width: 52rem) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap;
    align-items: center; gap: .5rem; padding: .6rem .75rem;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .rail__group { display: flex; flex-wrap: wrap; gap: .25rem; }
  .rail__label, .rail__foot { display: none; }
  .content { padding: 1rem 1rem 4rem; }
}
