/* Layout: sticky app bar with the tournament + save state; summary strip; tabs (Înscriși first); one dense, operable list */
:root {
  --bg: #eef2f5;
  --surface: #ffffff;
  --sunk: #f6f8fa;
  --ink: #15202b;
  --muted: #5a6a79;
  --line: #d6dee6;
  --accent: #1d5ea8;      /* table blue */
  --accent-soft: #e3edf8;
  --ball: #e5702a;        /* ball orange, attention */
  --ok: #1d8657;
  --ok-soft: #e1f3ea;
  --warn: #b76f07;
  --warn-soft: #fbf0dc;
  --bad: #c03a3a;
  --bad-soft: #f9e5e5;
  --c-hobby: #6b7d1f; --c-avansati: #1d5ea8; --c-open: #8a3fb0; --c-elite: #b3462a;
  --f-display: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #0e141b; --surface: #16202a; --sunk: #121a23; --ink: #e5ecf2; --muted: #93a3b2; --line: #283543;
  --accent: #6ea8ea; --accent-soft: #1b2d42; --ball: #f08a4b;
  --ok: #4fc48f; --ok-soft: #15302a; --warn: #e3a944; --warn-soft: #33281a; --bad: #ef7777; --bad-soft: #3a1f22;
  --c-hobby: #b5c95a; --c-avansati: #6ea8ea; --c-open: #c792e6; --c-elite: #f0906f;
  color-scheme: dark; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.45; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2 { font-family: var(--f-display); font-weight: 700; margin: 0; text-wrap: balance; }
h2 { font-size: 1.15rem; }
.muted { color: var(--muted); }
.wrap { max-width: 1120px; margin: 0 auto; padding-block: 16px 60px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

/* app bar */
.appbar { position: sticky; top: 0; z-index: 15; background: var(--surface); border-bottom: 1px solid var(--line); }
.appbar-in { max-width: 1120px; margin: 0 auto; min-height: var(--bar-h); padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.appbar .ttl { flex: 1 1 260px; min-width: 0; }
.appbar h1 { font-size: 1.45rem; line-height: 1.15; overflow-wrap: anywhere; }
.appbar .meta { color: var(--muted); font-size: .88rem; }
.appbar .acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 7px 13px; cursor: pointer; font-weight: 600; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { border-color: var(--line); }
.btn.big { min-height: 46px; font-size: 1.05rem; }
.btn.icon-b { padding-inline: 10px; }
.btn.danger-s { color: var(--bad); border-color: var(--bad); }
.btn.danger-f { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.btn svg { width: 17px; height: 17px; flex: none; }
input[type=file] { display: none; }
.show-s { display: none; }
@media (max-width: 760px) { .show-s { display: inline; } }
.linkbtn { border: 0; background: transparent; color: var(--bad); text-decoration: underline; cursor: pointer; padding: 0 2px; font-size: .85rem; }

/* save state chip */
.chip-s { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--sunk); border-radius: 20px; padding: 5px 12px; font-size: .86rem; font-weight: 600; color: var(--muted); cursor: default; white-space: nowrap; }
.chip-s .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: none; }
.chip-s.warn { color: var(--warn); } .chip-s.warn .dot { background: var(--ball); }
.chip-s.bad { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); cursor: pointer; } .chip-s.bad .dot { background: var(--bad); }

/* menu */
.menu-w { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 270px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(10, 20, 30, .18); padding: 6px; display: grid; }
.menu > button, .menu > label { display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: transparent; padding: 10px 12px; border-radius: 7px; cursor: pointer; font-weight: 500; }
.menu > button:hover, .menu > label:hover { background: var(--sunk); }
.menu svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.menu .danger { color: var(--bad); border-top: 1px solid var(--line); border-radius: 0 0 7px 7px; margin-top: 4px; }

/* banners & cards */
.banner { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 11px 14px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.banner.warn { border-color: var(--warn); background: var(--warn-soft); }
.banner.bad { border-color: var(--bad); background: var(--bad-soft); }
.b-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 14px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.danger-box { border-color: var(--bad); }
.danger-box h2 { color: var(--bad); }
.danger-box p { margin: 0; max-width: 70ch; }
.rb-step { display: grid; gap: 12px; }

/* forms */
.field { display: grid; gap: 4px; min-width: 0; }
.field label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.field input, .field select { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; min-width: 0; width: 100%; min-height: 40px; }
.grid-f { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.grid-f .span2 { grid-column: span 2; }
.grid-f .span-all { grid-column: 1 / -1; }
.form-a { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.form-a .grow { flex: 1; }
.hint { color: var(--muted); font-size: .86rem; margin: 0; flex: 1 1 240px; min-width: 0; }
.add-f { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.add-f .field { flex: 1 1 160px; }
.add-a { display: flex; gap: 8px; }
.ex-g { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 6px 12px; align-items: start; }
.ex-l { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding-top: 3px; }
.ex-o { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.ck { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.ck input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-f { width: min(380px, 100%); }
.login-f h1 { font-size: 1.8rem; }
.login-f p { margin: 0; }
.err { color: var(--bad); font-weight: 600; margin: 0; }

/* tournament list */
.tlist { display: grid; gap: 10px; }
.tcard { display: grid; grid-template-columns: 58px minmax(0, 1fr) minmax(0, 280px) auto; gap: 6px 16px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none; }
.tcard:hover { border-color: var(--accent); }
.tnr { font-family: var(--f-display); font-weight: 700; font-size: 1.5rem; color: var(--accent); background: var(--accent-soft); border-radius: 10px; text-align: center; padding: 8px 0; font-variant-numeric: tabular-nums; }
.tmain { display: grid; min-width: 0; }
.tname { font-weight: 600; font-size: 1.05rem; overflow-wrap: anywhere; }
.tmeta { color: var(--muted); font-size: .86rem; }
.tstat { display: grid; gap: 6px; font-size: .9rem; font-variant-numeric: tabular-nums; }
.ok-t { color: var(--ok); } .bad-t { color: var(--bad); }
.tgo { color: var(--accent); font-weight: 600; }

/* summary */
.summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stat { background: var(--surface); padding: 11px 14px; display: grid; gap: 2px; }
.stat .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.stat .v { font-family: var(--f-display); font-weight: 700; font-size: 1.55rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .v small { font-size: .9rem; color: var(--muted); font-weight: 600; }
.stat.ok .v { color: var(--ok); } .stat.ex .v { color: var(--accent); } .stat.bad .v { color: var(--bad); }

/* tabs */
.tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.tab { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px 11px; cursor: pointer; display: grid; gap: 5px; position: relative; min-width: 0; }
.tab:hover { border-color: var(--accent); }
.tab[aria-selected="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.tab .name { font-family: var(--f-display); font-weight: 700; font-size: 1.08rem; letter-spacing: .02em; }
.tab-all .name { color: var(--accent); }
.tab .count { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab .count b { color: var(--ink); font-weight: 600; }
.bar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; display: block; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.tab .flag { position: absolute; top: 8px; right: 9px; background: var(--ball); color: var(--surface); font-size: .72rem; font-weight: 700; border-radius: 10px; padding: 1px 7px; }

/* list panel */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.toolbar { position: sticky; top: var(--bar-h); z-index: 5; background: var(--surface); border-radius: 12px 12px 0 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.toolbar .search { flex: 1 1 220px; min-width: 0; background: var(--sunk); border: 1px solid var(--line); border-radius: 7px; padding: 8px 11px; min-height: 40px; }
.tb-a { display: flex; gap: 8px; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 7px 11px; cursor: pointer; font-weight: 500; color: var(--muted); min-height: 38px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button .n { font-variant-numeric: tabular-nums; font-size: .8rem; opacity: .8; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }

.list { display: grid; }
.row { display: grid; grid-template-columns: 44px 34px minmax(0, 1fr) minmax(0, 1.2fr) 220px 80px; gap: 4px 10px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; border-radius: 0 0 12px 12px; }
.row:hover { background: var(--sunk); }
.row.head { padding-block: 7px; background: var(--sunk); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; color: var(--muted); }
.row.head .r { text-align: right; }
.row.paid:not(.wd) { background: color-mix(in srgb, var(--ok-soft) 55%, transparent); }
.row.ex:not(.wd) { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.row.wd { background: var(--sunk); }
.row.wd .who, .row.wd .nr { opacity: .55; }
.row.wd .who .n { text-decoration: line-through; text-decoration-thickness: 1px; }
.row > input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--ok); cursor: pointer; margin: 0; }
.row .nr { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .85rem; text-align: right; }
.who { min-width: 0; cursor: pointer; }
.who .n { font-weight: 600; }
.who .n span { font-weight: 400; }
.who .c { color: var(--muted); font-size: .85rem; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; }
.catp { font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; line-height: 1.5; }
.cat-Hobby { color: var(--c-hobby); } .cat-Avansati { color: var(--c-avansati); } .cat-Open { color: var(--c-open); } .cat-Elite { color: var(--c-elite); }
.pay { min-width: 0; font-size: .87rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 3px 8px; align-items: center; }
.pay .d { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 500; }
.wd-t { display: inline-flex; align-items: center; gap: 6px; justify-self: end; font-size: .86rem; color: var(--muted); cursor: pointer; white-space: nowrap; min-height: 32px; }
.row .wd-t input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--muted); margin: 0; }
.row.wd > .wd-t { color: var(--ink); font-weight: 600; }
.ex-c { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ex-c .wd-t { justify-self: auto; }
.ex-c select { min-width: 0; flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font-size: .86rem; min-height: 32px; }
.row.ex .ex-c .wd-t { color: var(--ink); font-weight: 600; }
.row .ex-c input[type=checkbox] { accent-color: var(--accent); }
.pill { display: inline-block; font-size: .72rem; font-weight: 600; border-radius: 10px; padding: 1px 8px; white-space: nowrap; letter-spacing: .02em; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info, .pill.ex { background: var(--accent-soft); color: var(--accent); }
.pill.muted { background: var(--line); color: var(--ink); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.empty.big { padding: 48px 16px; font-size: 1.02rem; }
.empty b { color: var(--ink); }
.empty-a { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }

/* transactions */
.tx { padding: 13px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 7px; }
.tx:last-child { border-bottom: 0; }
.tx-h { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.tx-h .amt { font-family: var(--f-display); font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.tx-h .dt { font-variant-numeric: tabular-nums; color: var(--muted); }
.tx-h .grow { flex: 1; }
.tx .meta { font-size: .9rem; display: grid; gap: 1px; min-width: 0; }
.tx .meta span { color: var(--muted); }
.tx .meta div { overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); border-radius: 14px; padding: 3px 4px 3px 10px; font-size: .86rem; }
.chip em { font-style: normal; color: var(--muted); font-size: .78rem; }
.chip button { border: 0; background: transparent; cursor: pointer; color: var(--muted); width: 22px; height: 22px; border-radius: 11px; line-height: 1; }
.chip button:hover { background: var(--bad-soft); color: var(--bad); }
.assign { display: flex; gap: 6px; flex: 1 1 240px; min-width: 0; }
.assign input { flex: 1; min-width: 0; background: var(--sunk); border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; font-size: .88rem; }
.assign .btn { min-height: 32px; padding: 4px 10px; font-size: .86rem; }
.sect { padding: 10px 14px; background: var(--sunk); border-bottom: 1px solid var(--line); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }
.sect:first-child { border-radius: 12px 12px 0 0; }
.tx.ign { opacity: .85; }

.foot { color: var(--muted); font-size: .85rem; margin: 0; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 9px; font-weight: 500; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.2); z-index: 40; }
.busy { position: fixed; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 70%, transparent); z-index: 50; font-weight: 600; }
.busy > div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 20px; }
.dropov { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 22%, transparent); pointer-events: none; }
.dropov > div { background: var(--surface); border: 2px dashed var(--accent); border-radius: 14px; padding: 28px 40px; text-align: center; font-weight: 700; font-size: 1.2rem; }
.dropov small { font-weight: 500; color: var(--muted); font-size: .9rem; }

@media (max-width: 900px) {
  .tabs { display: flex; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
  .tab { flex: 0 0 auto; min-width: 128px; }
  .grid-f { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tcard { grid-template-columns: 52px minmax(0, 1fr); }
  .tstat, .tgo { grid-column: 2; }
  .tgo { display: none; }
}
@media (max-width: 760px) {
  :root { --bar-h: 108px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary .stat:last-child { grid-column: span 2; }
  .row { grid-template-columns: 34px minmax(0, 1fr) auto; padding: 10px 12px; }
  .row .nr, .row.head { display: none; }
  .row > .wd-t { grid-column: 3; grid-row: 1; }
  .row .pay, .row .ex-c { grid-column: 2 / 4; }
  .toolbar { position: static; }
  .appbar { position: static; }
  .hide-s { display: none; }
  .seg { flex-wrap: nowrap; overflow-x: auto; width: 100%; min-width: 0; max-width: 100%; flex: 1 1 100%; }
  .seg button { flex: 1 0 auto; white-space: nowrap; }
  .appbar h1 { font-size: 1.2rem; }
}
@media (max-width: 520px) {
  .ex-g { grid-template-columns: 1fr; }
  .grid-f { grid-template-columns: 1fr; }
  .grid-f .span2 { grid-column: auto; }
  .seg button { padding-inline: 8px; }
  .tb-a { width: 100%; } .tb-a .btn { flex: 1; }
  .menu { position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
