/* Botkassa, TeamGym edition: competition-floor blue, chalk white, and the judge's score paddle. */
:root {
  --floor: #1E3A9E;
  --floor-2: #2B4CC4;
  --chalk: #F4F5F8;
  --surface: #FFFFFF;
  --ink: #131A35;
  --mute: #596180;
  --line: #D7DBE7;
  --band: #FF4F7B;
  --band-ink: #3A0A1A;
  --owe: #B3203F;
  --green: #13805A;
  --bar: #3A57C8;
  --focus: #D61F5A;
  --on-floor: #F4F5F8;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Barlow', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --floor: #172C78;
    --floor-2: #2E4DC0;
    --chalk: #0D1124;
    --surface: #161B33;
    --ink: #E7E9F3;
    --mute: #9CA3C0;
    --line: #2A3150;
    --owe: #FF7A93;
    --green: #4CC995;
    --bar: #7F98F0;
    --focus: #FF8FAB;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--chalk); color: var(--ink);
  font: 400 1rem/1.5 var(--body); font-variant-numeric: tabular-nums;
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.1; margin: 0; letter-spacing: .005em; }
h2 { font-size: 1.5rem; margin: 2rem 0 .75rem; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted, small { color: var(--mute); }
small { display: block; font-size: .875rem; }
em { font-style: normal; color: var(--mute); font-weight: 400; }

/* The judge's score paddle: the one loud element. White card, coral band, a number. */
.paddle {
  display: inline-grid; place-items: center; width: .8em; height: 1.05em; flex: none;
  background: #fff; border-top: .26em solid var(--band); border-radius: 2px;
  box-shadow: 0 0 0 1px rgb(19 26 53 / .18), 0 1px 2px rgb(0 0 0 / .2);
  vertical-align: -.15em; color: #131A35;
}
.paddle b { font: 700 1em/1 var(--display); }

/* ---------- layout ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: calc(.75rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) .75rem max(1rem, env(safe-area-inset-left));
  background: var(--floor); color: var(--on-floor);
}
.wordmark { display: flex; align-items: center; gap: .55rem; font: 700 1.5rem var(--display); text-decoration: none; }
.who { display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.who .link { color: var(--on-floor); }
@media (max-width: 26rem) { .who span { display: none; } }
.wrap { max-width: 56rem; margin: 0 auto; padding: 1.25rem 1rem 7rem; }
.page-title { font-size: clamp(2rem, 7vw, 3rem); margin: .25rem 0 1rem; overflow-wrap: anywhere; }
.title-row { display: flex; align-items: center; gap: .9rem; margin: .25rem 0 1rem; }
.title-row .page-title { margin: 0; }
.back { display: inline-block; font-size: .9rem; color: var(--mute); text-decoration: none; margin-top: .25rem; }
.back::before { content: '‹ '; }
.empty { padding: 1.5rem; border: 1px dashed var(--line); border-radius: 8px; color: var(--mute); }
.card-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin-top: 1.5rem; }

/* ---------- images ---------- */
.logo { width: 3.5rem; height: 3.5rem; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--line); flex: none; }
.logo.small { width: 2.5rem; height: 2.5rem; border-radius: 8px; }
.logo-blank { display: grid; place-items: center; font: 700 1.25rem var(--display); color: var(--bar); background: color-mix(in srgb, var(--floor-2) 18%, var(--surface)); }
.avatar {
  width: 2.5rem; height: 2.5rem; border-radius: 50%; flex: none; object-fit: cover;
  display: inline-grid; place-items: center; font: 600 .95rem var(--display); letter-spacing: .02em;
  background: color-mix(in srgb, var(--floor-2) 18%, var(--surface)); color: var(--bar);
}
.avatar.small { width: 2rem; height: 2rem; font-size: .8rem; }
.avatar.big { width: 4rem; height: 4rem; font-size: 1.4rem; }
.upload { position: relative; }
.upload:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.image-edit { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* ---------- controls ---------- */
label { display: block; font-weight: 500; font-size: .95rem; }
input, select {
  display: block; width: 100%; margin-top: .3rem; padding: .65rem .75rem; min-height: 2.75rem;
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px;
}
input:focus, select:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 2px var(--focus); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 2.75rem; padding: .55rem 1.1rem; font: 600 1rem var(--body);
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
}
.btn:hover { border-color: var(--mute); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--floor-2); border-color: var(--floor-2); color: #fff; }
.btn-primary:hover { background: var(--floor); }
.btn-paddle { background: var(--band); border-color: var(--band); color: var(--band-ink); font: 700 1.2rem var(--display); }
.btn-paddle:hover { border-color: var(--band-ink); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--mute); }
.btn-small { min-height: 2.5rem; padding: .4rem .8rem; font-size: .9rem; }
.btn-danger { color: var(--owe); border-color: currentColor; background: transparent; margin-top: 1rem; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; cursor: pointer; }
.icon-btn { background: none; border: 0; font-size: 1.5rem; line-height: 1; color: var(--mute); width: 2.5rem; height: 2.5rem; border-radius: 6px; cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--line); color: var(--ink); }
.stack { display: grid; gap: 1rem; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem; }
.inline-form .grow { flex: 1 1 12rem; }
.amount { position: relative; flex: 0 0 8rem; }
.amount input { padding-right: 2.2rem; }
.amount > span:last-child { position: absolute; right: .75rem; bottom: .7rem; color: var(--mute); }
.amount.big input { font: 700 1.75rem var(--display); min-height: 3.25rem; }
.amount.big > span:last-child { bottom: .9rem; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.auth-hero { background: var(--floor); color: var(--on-floor); padding: calc(2.5rem + env(safe-area-inset-top)) 1.25rem 2rem; display: flex; flex-direction: column; justify-content: flex-end; }
.auth-hero h1 { font-size: clamp(2.5rem, 9vw, 4.5rem); max-width: 12ch; margin-top: 1.75rem; }
.auth-hero p { max-width: 34ch; font-size: 1.1rem; opacity: .85; margin: 1rem 0 0; }
/* A judges' panel raising their scores, in turn. The only load animation in the app. */
.panel { display: flex; gap: 1rem; align-items: flex-end; height: 8rem; }
.panel .paddle { font-size: 4.6rem; animation: raise .55s cubic-bezier(.2, .9, .3, 1.25) both; }
.panel .paddle b { font-size: .34em; }
.panel .paddle:nth-child(1) { animation-delay: .15s; }
.panel .paddle:nth-child(2) { animation-delay: .35s; translate: 0 -.12em; }
.panel .paddle:nth-child(3) { animation-delay: .55s; }
@keyframes raise { from { transform: translateY(70%); opacity: 0; } }
.auth-panel { padding: 2rem 1.25rem; max-width: 26rem; width: 100%; justify-self: center; }
.auth-panel h2 { margin-top: 0; font-size: 2rem; }
@media (min-width: 52rem) {
  .auth { grid-template-columns: 1.1fr 1fr; }
  .auth-hero { padding: 4rem; }
  .auth-panel { align-self: center; }
}

/* ---------- rows ---------- */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rows li { border-bottom: 1px solid var(--line); }
.rows a, .rows button {
  display: flex; align-items: center; gap: .85rem; width: 100%; padding: .75rem .25rem;
  background: none; border: 0; font: inherit; color: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.rows a:hover, .rows button:hover { background: color-mix(in srgb, var(--line) 35%, transparent); }
.row-main { flex: 1; min-width: 0; }
.row-main strong { display: block; font-weight: 600; }
.row-fig { font: 600 1.35rem var(--display); text-align: right; white-space: nowrap; }
.row-fig small { font: 400 .8rem var(--body); }
.owe, .owe strong { color: var(--owe); }
.trackers .row-fig:nth-of-type(2) { display: none; }
@media (min-width: 36rem) { .trackers .row-fig:nth-of-type(2) { display: block; min-width: 7rem; } }
/* A fanned hand of paddles, one per fine (max 5). */
.tally { display: flex; font-size: 1rem; padding-right: .2em; }
.tally .paddle { transform: rotate(-10deg); box-shadow: 0 0 0 1px rgb(19 26 53 / .25), -2px 0 0 var(--chalk); }
.tally .paddle + .paddle { margin-left: -.35em; }
@media (max-width: 26rem) { .tally { display: none; } }

/* ---------- tracker ---------- */
.tabs { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; scrollbar-width: none; }
.tabs a { padding: .6rem .9rem; text-decoration: none; color: var(--mute); font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--band); }

.board { display: grid; gap: 1.25rem; background: var(--floor); color: var(--on-floor); border-radius: 12px; padding: 1.25rem 1.25rem 1.5rem; }
.board-main span { font-size: .95rem; opacity: .8; }
.board-main strong { display: block; font: 700 clamp(3.5rem, 15vw, 6.5rem)/0.95 var(--display); letter-spacing: -.01em; }
.board-side { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin: 0; }
.board-side dt { font-size: .8rem; opacity: .75; }
.board-side dd { margin: 0; font: 600 1.35rem var(--display); }
@media (min-width: 40rem) {
  .board { grid-template-columns: 1.4fr 1fr; align-items: end; padding: 1.75rem; }
  .board-side { grid-template-columns: 1fr; border-left: 1px solid rgb(255 255 255 / .2); padding-left: 1.25rem; }
}
.mine { margin: 1rem 0 0; font-size: 1.1rem; }
.pay { margin-top: .75rem; padding: 1rem; border-radius: 10px; background: var(--surface); border-left: 4px solid var(--band); }
.pay p { margin: 0; }
.pay-to { overflow-wrap: anywhere; }
.pay-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }

.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; gap: .5rem; justify-content: center;
  padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--chalk) 92%, transparent);
  border-top: 1px solid var(--line); backdrop-filter: blur(6px);
}
.actionbar .btn-paddle { flex: 1 1 auto; max-width: 14rem; }
@media (max-width: 30rem) {
  .actionbar { flex-wrap: wrap; }
  .actionbar .btn-paddle { flex: 1 1 40%; max-width: none; }
  .actionbar .btn:not(.btn-paddle) { flex: 1; font-size: .9rem; padding-inline: .5rem; }
  .wrap { padding-bottom: 10rem; }
}

/* entries */
.dayhead { font: 600 1rem var(--body); color: var(--mute); margin: 1.25rem 0 .4rem; }
.entries { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.entry { display: flex; align-items: center; gap: .75rem; padding: .65rem .75rem; }
.entry + .entry { border-top: 1px solid var(--line); }
.entry-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.amt { font: 600 1.25rem var(--display); white-space: nowrap; }
.entry-who { position: relative; flex: none; }
.entry-who .paddle { position: absolute; right: -.3rem; bottom: -.2rem; font-size: .9rem; }
.entry-deposit .amt { color: var(--green); }
.entry-expense .expense-mark { width: 2rem; height: 2rem; border-radius: 50%; border: 2px dashed var(--mute); flex: none; }

.filters { display: flex; flex-wrap: wrap; gap: .75rem; }
.filters label { flex: 1 1 10rem; }

/* stats */
.figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin: 0; }
.figures div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .75rem 1rem; }
.figures dt { font-size: .85rem; color: var(--mute); }
.figures dd { margin: 0; font: 700 1.75rem var(--display); }
.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.bars li { display: grid; grid-template-columns: minmax(6rem, 10rem) 1fr auto; align-items: center; gap: .75rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: .75rem; }
.bar { display: block; height: 100%; width: var(--w); min-width: 3px; background: var(--bar); border-radius: 0 4px 4px 0; }
.bar-val { font: 600 1.1rem var(--display); min-width: 4.5rem; text-align: right; }
.columns { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; height: 11rem; align-items: end; border-bottom: 1px solid var(--line); }
.col { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; outline-offset: 0; }
.col-bar { width: min(70%, 2rem); height: var(--h); min-height: 1px; background: var(--bar); border-radius: 4px 4px 0 0; }
.col-label { position: absolute; top: 100%; font-size: .75rem; color: var(--mute); padding-top: .25rem; }
.col:hover .col-bar, .col:focus .col-bar { background: var(--floor); }
.col:hover::after, .col:focus::after {
  content: attr(data-tip); position: absolute; bottom: 100%; white-space: nowrap; z-index: 2;
  background: var(--ink); color: var(--chalk); font-size: .85rem; padding: .25rem .5rem; border-radius: 4px;
}
.col:first-child::after { left: 0; } .col:last-child::after { right: 0; }
.chart details { margin-top: 2rem; font-size: .9rem; }
.chart summary { cursor: pointer; color: var(--mute); }
.chart table { border-collapse: collapse; margin-top: .5rem; }
.chart td, .chart th { padding: .2rem 1.5rem .2rem 0; text-align: left; }

/* settings */
.settings h2:first-child { margin-top: 0; }
.setting-list { list-style: none; padding: 0; margin: 0 0 .75rem; display: grid; gap: .5rem; }
.setting-list .archived { opacity: .55; }
.opening .amount { max-width: 10rem; }
.opening-row { display: flex; align-items: center; gap: .6rem; }
.opening-row .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.opening-row input { margin: 0; }
.member-row { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.member-row .avatar { margin-top: .3rem; }
.member-row .inline-form { flex: 1; }
.invite { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.invite input { flex: 1 1 14rem; margin: 0; font-size: .85rem; }
.invite-meta { flex-basis: 100%; font-size: .9rem; font-weight: 600; }

/* super-admin */
.admin-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.admin-list li { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.admin-list .row-main { flex: 1 1 12rem; }
.admin-list .invite { flex-basis: 100%; }

/* ---------- dialog ---------- */
dialog {
  width: min(32rem, 100vw); max-height: 92vh; padding: 0; border: 0; border-radius: 14px;
  background: var(--chalk); color: var(--ink);
}
dialog::backdrop { background: rgb(8 12 30 / .6); }
dialog form { padding: 1.25rem; }
@media (max-width: 36rem) {
  dialog { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 14px 14px 0 0; }
  dialog form { padding-bottom: calc(1.25rem + env(safe-area-inset-bottom)); }
}
.dlg-head { display: flex; justify-content: space-between; align-items: center; }
.dlg-head h2 { margin: 0; font-size: 1.9rem; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 500; font-size: .95rem; padding: 0; margin-bottom: .5rem; }
.picker, .chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.picker legend, .chips legend { flex-basis: 100%; }
.picker label, .chips label { position: relative; cursor: pointer; }
.picker input, .chips input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }

/* Fine picker: each fine type is a judge's paddle. Picking one raises it. */
.picker label { width: 5.75rem; display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center; font-weight: 500; font-size: .85rem; line-height: 1.2; padding: .6rem .2rem .4rem; border-radius: 8px; }
.picker .paddle { font-size: 3.2rem; transform: rotate(-6deg) translateY(4px); transition: transform .2s cubic-bezier(.2, .9, .3, 1.4), box-shadow .2s; }
.picker .paddle b { font-size: .34em; }
.picker .paddle.blank { background: transparent; border: 2px dashed var(--mute); box-shadow: none; color: var(--mute); }
.picker input:checked + .paddle { transform: translateY(-6px); box-shadow: 0 0 0 1px rgb(19 26 53 / .18), 0 10px 16px rgb(0 0 0 / .25); }
.picker label:has(input:checked) { background: var(--surface); outline: 2px solid var(--ink); }
.picker label:has(input:focus-visible) { outline: 3px solid var(--focus); }
.chips .pick-name { display: inline-block; padding: .45rem .9rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.chips input:checked + .pick-name { background: var(--floor-2); border-color: var(--floor-2); color: #fff; }
.chips input:focus-visible + .pick-name { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Multi-fine counters: one row per member, − count + */
.counters { display: grid; gap: .25rem; }
.counter { display: flex; align-items: center; gap: .6rem; padding: .35rem .5rem; border-radius: 8px; }
.counter.on { background: var(--surface); outline: 2px solid var(--band); }
.counter-name { flex: 1; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.counter .avatar { width: 2rem; height: 2rem; font-size: .8rem; }
.counter output { min-width: 1.6rem; text-align: center; font: 600 1.4rem var(--display); }
.step { width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 1.4rem/1 var(--display); cursor: pointer; }
.step:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* join */
.join { max-width: 30rem; margin: 2rem auto; padding: 1.5rem; }
.join h1 { font-size: 2.25rem; margin: 1rem 0 .5rem; }
.join .stack { margin-top: 1rem; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 6rem; transform: translate(-50%, 1rem); opacity: 0; pointer-events: none; z-index: 20;
  background: var(--ink); color: var(--chalk); padding: .65rem 1rem; border-radius: 8px; max-width: calc(100vw - 2rem);
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--owe); color: #fff; }

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

/* account + link dialog */
.account { margin-top: 3rem; }
.dlg-body { padding: 1.25rem; }
