:root {
  --bg: #0f1220;
  --card: #191d2f;
  --card-2: #212642;
  --ink: #eef1ff;
  --muted: #99a0c0;
  --accent: #6c7bff;
  --accent-2: #4ad3a7;
  --line: #2b3153;
  --gold: #ffd166;
  --silver: #cfd6e6;
  --bronze: #e0975a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, #1c2140, var(--bg));
  color: var(--ink);
  min-height: 100vh;
}
.wrap { max-width: 760px; margin: 0 auto; padding: 20px 16px 64px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
h1 { font-size: 22px; margin: 8px 0; }
.week-pill { color: var(--muted); font-size: 14px; }
.tabs { display: flex; gap: 8px; margin: 16px 0; }
.tab {
  flex: 1; padding: 11px; border: 1px solid var(--line); background: var(--card);
  color: var(--muted); border-radius: 12px; cursor: pointer; font-size: 15px; font-weight: 600;
}
.tab.active { background: var(--accent); color: white; border-color: var(--accent); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 16px; }
label.fld { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=number], input[type=password] {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--ink); font-size: 16px;
}
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.item-info { min-width: 0; }
.row .name { font-size: 15px; line-height: 1.25; }
.pts-badge { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Big tap-friendly counter */
.stepper {
  display: flex; align-items: center; flex: none;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.stepper button {
  width: 46px; height: 46px; border: none; background: transparent; color: var(--ink);
  font-size: 26px; font-weight: 700; line-height: 1; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background .12s;
}
.stepper button:hover { background: rgba(255,255,255,.06); }
.stepper button:active { background: rgba(255,255,255,.16); }
.stepper button:disabled { opacity: .25; cursor: not-allowed; }
.stepper .val {
  width: 48px; height: 46px; padding: 0; text-align: center;
  font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums;
  border: none; outline: none; background: transparent; color: var(--ink);
  -moz-appearance: textfield;
}
.stepper .val::-webkit-inner-spin-button, .stepper .val::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper .val:focus { background: rgba(255,255,255,.08); }
.stepper.filled { border-color: var(--accent); }
.stepper.filled .val { color: var(--accent-2); }

/* Shnayim Mikra */
.sm-row { padding: 14px 0 4px; border-top: 1px solid var(--line); }
.sm-head, .sm-bonus-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sm-bonus-row { margin-top: 14px; }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 54px; height: 30px; flex: none; cursor: pointer; }
.toggle input { display: none; }
.toggle .track { position: absolute; inset: 0; background: var(--card-2); border: 1px solid var(--line); border-radius: 20px; transition: .15s; }
.toggle .track::before { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--muted); transition: .15s; }
.toggle input:checked + .track { background: var(--accent-2); border-color: var(--accent-2); }
.toggle input:checked + .track::before { transform: translateX(23px); background: #062018; }
.total-bar {
  position: sticky; bottom: 0; margin-top: 12px; padding: 14px 16px;
  background: linear-gradient(90deg, var(--accent), #8a63ff); border-radius: 14px;
  display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.total-bar small { font-weight: 500; opacity: .85; }
button.go {
  width: 100%; margin-top: 16px; padding: 17px; border: none; border-radius: 14px;
  background: var(--accent-2); color: #062018; font-weight: 800; font-size: 17px; cursor: pointer;
  transition: transform .06s, filter .12s;
}
button.go:hover { filter: brightness(1.05); }
button.go:active { transform: scale(.985); }
button.go:disabled { opacity: .5; cursor: not-allowed; }
.msg { margin-top: 12px; padding: 12px; border-radius: 10px; font-size: 14px; }
.msg.ok { background: rgba(74,211,167,.15); color: var(--accent-2); }
.msg.err { background: rgba(255,107,107,.15); color: #ff9b9b; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--line); font-size: 15px; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; }
.rank { width: 34px; font-weight: 800; }
.rank.g1 { color: var(--gold); } .rank.g2 { color: var(--silver); } .rank.g3 { color: var(--bronze); }
.bar-cell { width: 120px; }
.bar { height: 8px; background: var(--card-2); border-radius: 6px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.muted { color: var(--muted); }
a.link { color: var(--accent); text-decoration: none; font-size: 14px; }
.small { font-size: 13px; }
/* Button system (admin) */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 16px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--ink); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: filter .12s, transform .06s, background .12s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: rgba(255,107,107,.14); border-color: rgba(255,107,107,.4); color: #ff9b9b; }
.btn.danger:hover { background: rgba(255,107,107,.24); filter: none; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 9px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
td.actions { text-align: right; }
select { padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); color: var(--ink); font-size: 15px; }
