:root {
  --red: #f40500;
  --red-dark: #c40400;
  --ink: #1b1b1b;
  --muted: #6b6b6b;
  --line: #e7e5e2;
  --bg: #f6f5f3;
  --card: #fff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }

.hero { background: var(--red); color: #fff; padding: 22px 0; }
.hero .wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 22px; }
.date { margin-left: auto; font-size: 1.15rem; font-weight: 700; white-space: nowrap; background: rgba(255, 255, 255, 0.18); padding: 6px 16px; border-radius: 999px; }
.hero img { display: block; height: 52px; width: auto; flex-shrink: 0; filter: brightness(0) invert(1); }
.hero h1 { margin: 0 0 2px; font-size: clamp(1.5rem, 5vw, 2rem); letter-spacing: -0.02em; }
.hero p { margin: 0; opacity: 0.92; }

main.wrap { margin-top: 44px; margin-bottom: 40px; }

.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  padding: 24px;
}

h2 { margin: 36px 0 16px; font-size: 1.3rem; }

form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
label { display: grid; gap: 6px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }

input, select {
  font: inherit;
  color: var(--ink);
  padding: 11px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  min-width: 0;
}
input:focus, select:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(244, 5, 0, 0.15); }

button {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  padding: 11px 22px;
  color: #fff;
  background: var(--red);
}
button:hover { background: var(--red-dark); }
button.ghost { background: none; color: var(--muted); padding: 6px 10px; border: 1.5px solid var(--line); font-size: 0.85rem; }
button.ghost:hover { color: var(--red); border-color: var(--red); background: none; }

.check { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 500; color: var(--ink); cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--red); }
#form button { grid-column: 3; grid-row: 1; }
.keeper { color: var(--muted); font-size: 0.8em; font-weight: 400; }

.msg { margin: 14px 0 0; font-weight: 600; min-height: 1.5em; }
.msg.ok { color: #1a7f37; }
.msg.err { color: var(--red); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.team { padding: 0; overflow: hidden; }
.team-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.team-head h3 { margin: 0; font-size: 1.05rem; }
.count { background: var(--red); color: #fff; border-radius: 999px; padding: 1px 10px; font-size: 0.85rem; font-weight: 700; }
.team ul { list-style: none; margin: 0; padding: 6px 18px 12px; }
.team li { padding: 7px 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.team li:last-child { border: 0; }
.empty { color: var(--muted); font-style: italic; }

.row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.row-actions select { padding: 4px 6px; font-size: 0.85rem; max-width: 180px; }

.admin-add { grid-template-columns: 1fr auto; }
#panel form + form, #panel .grid { margin-top: 16px; }
#panel .grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); }
.team li span { min-width: 0; overflow-wrap: anywhere; }
.login { max-width: 420px; margin: 0 auto; grid-template-columns: 1fr; }

@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .hero { padding: 16px 0; }
  .hero .wrap { gap: 10px 14px; }
  .hero img { height: 36px; }
  .date { flex: 0 0 100%; margin: 0; background: none; padding: 0; font-size: 1rem; }
  main.wrap { margin-top: 32px; }
  .card { padding: 18px; border-radius: 14px; }
  .team { padding: 0; }
  form, .admin-add { grid-template-columns: 1fr; }
  #form button { grid-column: auto; grid-row: auto; }
  input, select, form button { min-height: 48px; }
  .grid { grid-template-columns: 1fr; }
  h2 { margin: 28px 0 12px; }
  .team li { flex-wrap: wrap; padding: 10px 0; }
  .team-head { flex-wrap: wrap; }
  .row-actions { flex: 1 1 100%; }
  .row-actions select { flex: 1; max-width: none; min-height: 40px; }
  button.ghost { min-height: 40px; padding: 6px 14px; }
}
