*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
}

html {
  background: var(--bg, #050505);
  color-scheme: dark;
}

body {
  font-family: var(--font-body, "Outfit", system-ui, sans-serif);
  color: var(--text, #ffffff);
  background: var(--bg, #050505);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
  border: 0;
  background: none;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1,
h2,
h3,
.display {
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--team-secondary, var(--protv-cyan));
  font-weight: 600;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  box-shadow: var(--glow);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), opacity 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  color: #fff;
  background: var(--protv-gradient);
  box-shadow: var(--glow);
}

.btn-ghost {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.btn-danger {
  background: rgba(220, 50, 80, 0.2);
  border: 1px solid rgba(220, 50, 80, 0.4);
  color: #ff8aa0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(5, 5, 8, 0.7);
  outline: none;
}

.field textarea {
  min-height: 90px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--protv-cyan);
  box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.15);
}

.grid {
  display: grid;
  gap: 1rem;
}

.toast-wrap {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(12, 12, 20, 0.92);
  border: 1px solid var(--border);
  box-shadow: var(--glow);
}

.toast.error {
  border-color: rgba(255, 80, 100, 0.5);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
}

.modal {
  width: min(560px, calc(100% - 2rem));
  max-height: min(86vh, 760px);
  overflow: auto;
  padding: 1.3rem;
}

.modal h2 {
  margin-bottom: 1rem;
}

.empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
}

.counter {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--border);
}

.badge.active {
  color: #7dffc3;
  border-color: rgba(125, 255, 195, 0.35);
}

.badge.inactive {
  color: #ffb3c0;
  border-color: rgba(255, 140, 160, 0.35);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-head h1 {
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.form-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

select {
  min-height: 44px;
  padding: 0.45rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(5, 5, 8, 0.75);
  color: #fff;
}

.hidden {
  display: none !important;
}

.book-panel {
  padding: 1.1rem;
  margin-bottom: 1.2rem;
}

.book-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.book-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  align-items: end;
}

.book-form .btn {
  grid-column: 1 / -1;
  justify-self: start;
}

.slot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.45rem;
}

.slot-chip {
  min-height: 52px;
  padding: 0.4rem 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.slot-chip small {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
}

.slot-chip.picked {
  background: var(--protv-gradient);
  border-color: transparent;
}

.slot-chip.taken,
.slot-chip.off {
  opacity: 0.4;
  cursor: not-allowed;
}

.schedule-row {
  align-items: center;
}

.schedule-matchup {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.schedule-crest {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}

.schedule-crest.is-empty {
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  border: 1px dashed var(--border);
}

.schedule-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.schedule-crest-field {
  grid-column: 1 / -1;
}

.schedule-opp-prev {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin-top: 0.5rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.schedule-opp-prev.hide {
  display: none;
}

.schedule-admin-bar {
  padding: 1rem;
  margin-bottom: 1.2rem;
  display: grid;
  gap: 0.85rem;
}

.schedule-view-tabs,
.schedule-status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.schedule-view-tab {
  min-height: 40px;
  padding: 0.35rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  cursor: pointer;
}

.schedule-view-tab.is-active {
  background: var(--protv-gradient);
  border-color: transparent;
}

.schedule-admin-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.schedule-day-block {
  margin-bottom: 1.4rem;
}

.schedule-day-head {
  margin-bottom: 0.65rem;
}

.schedule-day-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.schedule-row.is-canceled {
  opacity: 0.55;
}

.schedule-row.is-canceled strong {
  text-decoration: line-through;
}

@media (max-width: 800px) {
  .book-grid,
  .book-form {
    grid-template-columns: 1fr;
  }

  .schedule-row {
    grid-template-columns: 1fr;
  }
}
