/* SLP Lax Board App — design system.
   Direction: refined institutional. Navy-dominant, warm paper surface,
   gold accent, Fraunces display + Public Sans body, tabular figures for money. */

:root {
  --navy-950: hsl(216, 55%, 9%);
  --navy-900: hsl(216, 48%, 13%);
  --navy-800: hsl(216, 42%, 19%);
  --navy-700: hsl(216, 34%, 28%);
  --navy-100: hsl(216, 35%, 92%);
  --gold-500: hsl(42, 68%, 52%);
  --gold-400: hsl(42, 78%, 62%);
  --paper: hsl(40, 33%, 97%);
  --card: hsl(0, 0%, 100%);
  --ink: hsl(216, 35%, 14%);
  --ink-muted: hsl(216, 15%, 44%);
  --hairline: hsl(216, 20%, 88%);
  --pos: hsl(152, 55%, 32%);
  --neg: hsl(356, 65%, 44%);
  --warn-bg: hsl(42, 90%, 94%);
  --warn-ink: hsl(36, 70%, 30%);
  --ok-bg: hsl(152, 45%, 94%);
  --err-bg: hsl(356, 70%, 96%);
  --radius: 10px;
  --shadow: 0 1px 2px hsl(216 40% 20% / 0.06), 0 4px 16px hsl(216 40% 20% / 0.05);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Public Sans", -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy-900), var(--navy-950));
  color: hsl(216, 30%, 82%);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0.9rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex; align-items: baseline; gap: 0.5rem;
  padding: 0 0.6rem 1.4rem;
  border-bottom: 1px solid hsl(216 40% 30% / 0.5);
  margin-bottom: 1.1rem;
}
.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: #fff;
  letter-spacing: 0.01em;
}
.brand-mark em { color: var(--gold-400); font-style: normal; }
.brand-sub {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: hsl(216, 25%, 62%);
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-radius: 7px;
  color: inherit;
  text-decoration: none;
  font-size: 0.92rem;
  border-left: 2px solid transparent;
}
.nav a:hover { background: hsl(216 40% 35% / 0.35); color: #fff; }
.nav a.active {
  background: hsl(216 45% 30% / 0.5);
  color: #fff;
  border-left-color: var(--gold-500);
}
.nav-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: hsl(216, 22%, 55%);
  padding: 1.1rem 0.7rem 0.35rem;
}

.sidebar-foot {
  margin-top: auto;
  padding: 0.9rem 0.7rem 0;
  border-top: 1px solid hsl(216 40% 30% / 0.5);
  font-size: 0.82rem;
}
.sidebar-foot .who { color: #fff; font-weight: 600; }
.sidebar-foot .role { color: var(--gold-400); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; }
.sidebar-foot a { color: hsl(216, 25%, 62%); text-decoration: none; }
.sidebar-foot a:hover { color: #fff; }

.main { flex: 1; padding: 2.2rem 2.6rem 3rem; max-width: 1100px; }

.page-head { margin-bottom: 1.6rem; }
.page-head h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.7rem;
  margin: 0 0 0.2rem;
  letter-spacing: -0.01em;
}
.page-head p { margin: 0; color: var(--ink-muted); }

/* ---------- Cards, tiles, tables ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.3rem 1.4rem;
  margin-bottom: 1.4rem;
}
.card h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.9rem;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.4rem;
}
.tile {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.2rem;
}
.tile .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  margin-bottom: 0.3rem;
}
.tile .value {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.tile .meta { font-size: 0.78rem; color: var(--ink-muted); margin-top: 0.25rem; }
.tile.warn { border-left: 3px solid var(--gold-500); }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  font-weight: 600;
  padding: 0.45rem 0.7rem;
  border-bottom: 1.5px solid var(--hairline);
}
td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.amount-pos { color: var(--pos); }
.amount-neg { color: var(--neg); }

/* ---------- Badges, flashes ---------- */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.14rem 0.55rem;
  border-radius: 99px;
}
.badge-success { background: var(--ok-bg); color: var(--pos); }
.badge-error { background: var(--err-bg); color: var(--neg); }
.badge-running { background: var(--warn-bg); color: var(--warn-ink); }
.badge-admin { background: var(--navy-100); color: var(--navy-800); }
.badge-board { background: var(--ok-bg); color: var(--pos); }
.badge-coach { background: var(--warn-bg); color: var(--warn-ink); }
.badge-inactive { background: hsl(216, 15%, 93%); color: var(--ink-muted); }

.flash { padding: 0.6rem 0.9rem; border-radius: 7px; font-size: 0.88rem; margin: 0.6rem 0 0; }
.flash-ok { background: var(--ok-bg); color: var(--pos); }
.flash-err { background: var(--err-bg); color: var(--neg); }

/* ---------- Forms, buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--font-body);
  font-size: 0.88rem; font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.05s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy-800); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }
.btn-gold { background: var(--gold-500); color: var(--navy-950); }
.btn-gold:hover { background: var(--gold-400); }
.btn-quiet { background: transparent; color: var(--navy-800); border-color: var(--hairline); }
.btn-quiet:hover { background: var(--navy-100); }
.btn-sm { font-size: 0.78rem; padding: 0.3rem 0.7rem; }

input[type="text"], input[type="email"], select {
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--hairline);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}
input:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}
.form-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; }
.form-row label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.75rem; font-weight: 600; color: var(--ink-muted); }

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1100px 500px at 80% -10%, hsl(216 50% 22% / 0.9), transparent),
    linear-gradient(165deg, var(--navy-900), var(--navy-950));
  padding: 1.5rem;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 24px 60px hsl(216 60% 5% / 0.5);
  padding: 2.4rem 2.2rem 2.2rem;
  text-align: center;
  animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.login-card .crest {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  color: var(--navy-900);
  margin-bottom: 0.1rem;
}
.login-card .crest em { color: var(--gold-500); font-style: normal; }
.login-card .tagline {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-muted);
  margin-bottom: 1.8rem;
}
.login-card .btn { width: 100%; justify-content: center; padding: 0.7rem 1rem; }
.login-note { margin-top: 1.4rem; font-size: 0.8rem; color: var(--ink-muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Dashboard components (Phase 1) ---------- */
/* Chart palette — validated for CVD safety against the paper surface. */
:root {
  --chart-in: #3f66ad;
  --chart-out: #a1761f;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; margin-bottom: 1.4rem; }
.grid-2 .card { margin-bottom: 0; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.tile-hero { border-top: 3px solid var(--gold-500); }
.tile-link { text-decoration: none; color: inherit; display: block; transition: box-shadow 0.15s ease; }
.tile-link:hover { box-shadow: 0 2px 6px hsl(216 40% 20% / 0.12), 0 8px 24px hsl(216 40% 20% / 0.1); }

.kv { width: 100%; }
.kv td { border-bottom: 1px solid var(--hairline); padding: 0.5rem 0.2rem; }
.kv-total td { font-weight: 700; border-bottom: none; border-top: 2px solid var(--navy-800); }

.fineprint { font-size: 0.8rem; color: var(--ink-muted); }
.nowrap { white-space: nowrap; }
.cell-clamp { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.row-total td { font-weight: 700; background: var(--navy-100); }
.row-done td { background: var(--ok-bg); color: var(--pos); font-weight: 600; }

/* Monthly flow chart — paired thin bars, baseline-anchored, 4px rounded ends. */
.chart-legend { display: flex; gap: 1.1rem; font-size: 0.78rem; color: var(--ink-muted); margin-bottom: 0.6rem; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 0.35rem; }
.swatch-in { background: var(--chart-in); }
.swatch-out { background: var(--chart-out); }
.flow-chart { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 0.4rem; }
.flow-month { flex: 1; display: flex; flex-direction: column; height: 100%; min-width: 34px; }
.flow-bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.flow-bar { width: 12px; min-height: 2px; border-radius: 4px 4px 0 0; }
.flow-in { background: var(--chart-in); }
.flow-out { background: var(--chart-out); }
.flow-label { text-align: center; font-size: 0.68rem; color: var(--ink-muted); padding-top: 0.35rem; border-top: 1.5px solid var(--hairline); font-variant-numeric: tabular-nums; }

/* Budget meter — % of budget consumed; overruns switch to the alert color. */
.meter { height: 10px; background: hsl(216, 20%, 91%); border-radius: 99px; overflow: hidden; min-width: 120px; }
.meter-fill { height: 100%; background: var(--chart-in); border-radius: 99px; }
.meter-over { background: var(--neg); }

.agenda-list { margin: 0; padding-left: 1.1rem; }
.agenda-list li { margin-bottom: 0.55rem; }
.prewrap { white-space: pre-wrap; }
.my-actions { list-style: none; margin: 0; padding: 0; }
.my-actions li { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.45rem 0; border-bottom: 1px solid var(--hairline); }
.my-actions li:last-child { border-bottom: none; }

.shift-mine td { background: hsl(216, 45%, 96%); }
.row-done-cell { background: var(--ok-bg); color: var(--pos); font-weight: 600; padding: 0.55rem 0.7rem; }

.filter-row { align-items: end; }
.filter-row .btn { margin-bottom: 1px; }
.resolve-row { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.resolve-row select { max-width: 190px; }
input[type="file"] { font-size: 0.85rem; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.8rem 1rem; }
  .brand { border: none; padding: 0; margin: 0 auto 0 0; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-label, .brand-sub { display: none; }
  .sidebar-foot { margin: 0; padding: 0; border: none; display: flex; gap: 0.7rem; align-items: center; }
  .main { padding: 1.3rem 1rem 2rem; }
}
