:root {
  --bg: #eef3fb;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe5f4;
  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --primary-soft: #eaf1ff;
  --danger: #dc2626;
  --warning-bg: #fff5f5;
  --warning-border: #fecaca;
  --shadow-sm: 0 8px 20px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 16px 34px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "SF Pro Text", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 50% -220px, #dce8ff 0%, transparent 70%),
    linear-gradient(180deg, #f7faff 0%, var(--bg) 100%);
}

body.modal-open {
  overflow: hidden;
}

.app-shell {
  width: 100%;
  margin: 0;
  padding: 18px;
}

.card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.event-header {
  position: relative;
  overflow: hidden;
  background: linear-gradient(140deg, #f9fbff 0%, #ffffff 60%, #f4f8ff 100%);
}

.event-header::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(29, 78, 216, 0.1) 0%, rgba(29, 78, 216, 0) 70%);
  pointer-events: none;
}

.event-topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  z-index: 1;
}

.event-title {
  text-align: center;
  flex: 1;
}

.event-logo {
  width: 92px;
  height: 92px;
  object-fit: contain;
  border: 0;
  background: transparent;
  flex-shrink: 0;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: 1.52rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.02rem;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.event-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.event-meta > div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px;
  background: var(--surface-soft);
}

.meta-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.event-meta p {
  margin: 0;
  font-weight: 700;
}

.grid {
  display: grid;
  gap: 11px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full {
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #334155;
  font-size: 0.88rem;
  font-weight: 600;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 11px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}

button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  background: var(--primary-dark);
  box-shadow: 0 10px 18px rgba(29, 78, 216, 0.22);
}

button:active {
  transform: translateY(1px);
}

.add-row-wrap {
  margin-top: 11px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1100px;
}

#coachesTable {
  min-width: 0;
}

th,
td {
  border: 1px solid #e5ebf5;
  padding: 9px;
  font-size: 0.84rem;
  vertical-align: middle;
}

th {
  background: #f5f9ff;
  color: #1e3a8a;
  text-align: left;
  font-weight: 700;
}

td input,
td select {
  width: 100%;
  padding: 7px;
  font-size: 0.84rem;
}

#athletesTable th:nth-child(2),
#athletesTable td:nth-child(2) {
  min-width: 280px;
}

#athletesTable th:nth-child(4),
#athletesTable td:nth-child(4) {
  min-width: 90px;
  width: 90px;
}

#athletesTable th:nth-child(3),
#athletesTable td:nth-child(3) {
  min-width: 230px;
}

#athletesTable th:nth-child(7),
#athletesTable td:nth-child(7) {
  min-width: 80px;
  width: 80px;
}

#athletesTable th:nth-child(10),
#athletesTable td:nth-child(10) {
  min-width: 120px;
  width: 120px;
  white-space: nowrap;
}

#athletesTable th:nth-child(11),
#athletesTable td:nth-child(11) {
  min-width: 56px;
  width: 56px;
  text-align: center;
}

#coachesTable th:nth-child(1),
#coachesTable td:nth-child(1) {
  width: 60px;
  min-width: 60px;
}

#coachesTable th:nth-child(2),
#coachesTable td:nth-child(2) {
  min-width: 320px;
}

#coachesTable th:nth-child(3),
#coachesTable td:nth-child(3) {
  width: 180px;
  min-width: 180px;
}

#coachesTable th:nth-child(4),
#coachesTable td:nth-child(4) {
  width: 56px;
  min-width: 56px;
  text-align: center;
}

.actions-btn {
  background: var(--danger);
  width: 30px;
  height: 30px;
  border-radius: 9px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.actions-btn:hover {
  background: #b91c1c;
}

.actions-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.totals-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
  font-size: 0.9rem;
}

.warning {
  margin-top: 12px;
  border: 1px solid var(--warning-border);
  background: var(--warning-bg);
  color: #7f1d1d;
  border-radius: 12px;
  padding: 11px;
  font-size: 0.86rem;
  line-height: 1.45;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  padding: 14px;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.05);
}

.summary-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.summary-value {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
}

.total-card {
  border-color: rgba(29, 78, 216, 0.35);
  background: linear-gradient(180deg, #f5f9ff 0%, #eff6ff 100%);
}

.grand-total {
  font-size: 1.25rem;
  color: #1e3a8a;
}

#exportBtn {
  display: block;
  margin: 0 auto;
}

.export-copy {
  margin: 0 0 10px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.privacy-link {
  display: inline-block;
  margin: 6px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #1d4ed8;
  text-decoration: underline;
  font-weight: 500;
  font-size: 0.8rem;
}

.privacy-link:hover {
  background: transparent;
  color: #1e40af;
  box-shadow: none;
}

.entry-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.64);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.entry-modal[hidden] {
  display: none;
}

.entry-modal-card {
  width: min(560px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}

.entry-modal-card h3 {
  margin: 0 0 10px;
}

.entry-modal-card p {
  margin: 0 0 14px;
  color: #334155;
  line-height: 1.45;
}

.site-footer {
  padding: 8px 16px 24px;
  text-align: center;
  color: #475569;
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
  line-height: 1.5;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 700;
}

.site-footer a:hover {
  color: #1e40af;
  text-decoration: underline;
}

.ig-icon {
  width: 16px;
  height: 16px;
}

@media (max-width: 900px) {
  .grid.two,
  .event-meta,
  .summary-cards {
    grid-template-columns: 1fr;
  }

  .event-logo {
    width: 64px;
    height: 64px;
  }

  .app-shell {
    padding: 10px;
  }

  .card {
    padding: 14px;
  }
}
