:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e2ec;
  --soft: #f5f7fa;
  --panel: #ffffff;
  --brand: #146c43;
  --brand-strong: #0f5132;
  --accent: #b42318;
  --warning: #9a6700;
  --shadow: 0 18px 45px rgba(18, 38, 63, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #eef3f7;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

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

button {
  cursor: pointer;
}

.auth-required .app-shell {
  display: none;
}

.auth-gate {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    linear-gradient(rgba(12, 28, 41, 0.58), rgba(12, 28, 41, 0.58)),
    url("https://images.unsplash.com/photo-1508344928928-7165b67de128?auto=format&fit=crop&w=1800&q=80") center/cover;
}

.auth-required .auth-gate {
  display: flex;
}

.auth-panel {
  width: min(480px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.app-shell {
  display: grid;
  grid-template-columns: 290px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px;
  color: #fff;
  background: #102033;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.brand-row h1,
.brand-row p,
.topbar h2,
.section-heading h3,
.panel h4 {
  margin: 0;
}

.brand-row h1 {
  font-size: 1.15rem;
}

.brand-row p,
.panel-header p,
.dialog-copy {
  margin: 4px 0 0;
  color: var(--muted);
}

.sidebar .brand-row p {
  color: rgba(255, 255, 255, 0.68);
}

.role-switcher,
.segmented-control,
.filter-row,
.topbar-actions,
.panel-actions,
.dialog-actions,
.calendar-controls,
.auth-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-button,
.segment-button,
.filter-chip,
.primary-action,
.secondary-action,
.auth-button,
.icon-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
}

.nav-button {
  width: 100%;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  text-align: left;
}

.nav-button.active,
.segment-button.active,
.filter-chip.active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.primary-action {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
  font-weight: 700;
}

.secondary-action:hover,
.auth-button:hover,
.icon-button:hover {
  border-color: #a8b5c2;
}

.wide {
  width: 100%;
  justify-content: center;
}

.icon-button {
  width: 40px;
  padding: 0;
  font-weight: 800;
}

main {
  padding: 28px;
  overflow-x: hidden;
}

.topbar,
.section-heading,
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand-strong);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-strip span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

.summary-strip strong {
  color: var(--ink);
}

.coach-layout,
.umpire-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 18px;
  margin-top: 18px;
}

.umpire-layout {
  grid-template-columns: 310px 1fr;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 25px rgba(18, 38, 63, 0.06);
}

.panel-header {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td small,
.muted {
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e7f5ee;
  color: var(--brand-strong);
  font-weight: 800;
  font-size: 0.78rem;
}

.status-pill.filled {
  background: #eef2f6;
  color: #475467;
}

.applicant-list,
.game-grid {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.applicant-card,
.game-card,
.rating-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.game-card header,
.applicant-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.game-card h4,
.applicant-card h5 {
  margin: 0;
}

.game-meta,
.applicant-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.rates-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rate {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--brand-strong);
}

.ratings-panel {
  margin-top: 18px;
}

.rating-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.rating-card span {
  color: var(--muted);
}

.field-card,
.account-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.field-card strong {
  font-size: 2rem;
}

.diamond {
  position: relative;
  width: 74px;
  height: 74px;
  margin: 4px auto 0;
  border: 2px solid rgba(255, 255, 255, 0.55);
  transform: rotate(45deg);
}

.base {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #fff;
}

.base.top {
  top: -5px;
  left: 31px;
}

.base.right {
  right: -5px;
  top: 31px;
}

.base.bottom {
  bottom: -5px;
  left: 31px;
}

.base.left {
  left: -5px;
  top: 31px;
}

.account-card {
  grid-template-columns: auto 1fr;
  margin-top: auto;
}

.account-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
  background: #f2c94c;
}

.account-card p {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.68);
}

.profile-panel {
  padding-bottom: 18px;
}

.profile-header {
  display: flex;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.avatar {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 8px;
  background: #dcefe6;
  color: var(--brand-strong);
  font-weight: 900;
}

.certification-editor,
.auth-section,
form.dialog-content {
  display: grid;
  gap: 14px;
}

.certification-editor {
  padding: 18px;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-row input {
  width: auto;
}

.profile-stats {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0 18px;
}

.profile-stats div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.profile-stats dt {
  color: var(--muted);
}

.profile-stats dd {
  margin: 0;
  font-weight: 800;
}

.umpire-mode {
  display: none;
}

.umpire-mode.active {
  display: grid;
}

.calendar-panel {
  padding-bottom: 18px;
}

.calendar-controls label {
  width: 132px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(92px, 1fr));
  gap: 1px;
  padding: 0 18px;
}

.calendar-weekdays {
  margin-top: 18px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.calendar-day {
  min-height: 118px;
  padding: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.calendar-day.outside {
  background: var(--soft);
  color: #98a2b3;
}

.calendar-day.today {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.day-number {
  font-weight: 900;
}

.calendar-event {
  display: block;
  margin-top: 6px;
  padding: 6px;
  border-radius: 6px;
  background: #e7f5ee;
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 800;
}

dialog {
  width: min(760px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(16, 32, 51, 0.56);
}

.dialog-content {
  padding: 22px;
}

.dialog-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.form-grid,
.import-workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.import-dialog {
  width: min(980px, calc(100vw - 28px));
}

.import-source {
  display: grid;
  gap: 12px;
}

.image-preview {
  display: grid;
  min-height: 210px;
  place-items: center;
  border: 1px dashed #a8b5c2;
  border-radius: 8px;
  overflow: hidden;
  background: var(--soft);
  color: var(--muted);
}

.image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 320px;
  object-fit: contain;
}

.auth-options,
.auth-section {
  margin-top: 14px;
}

.auth-button {
  flex: 1 1 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-mark {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  font-weight: 900;
}

.auth-google {
  color: #1a73e8;
  background: #e8f0fe;
}

.auth-apple {
  color: #111;
  background: #f2f4f7;
}

.auth-message,
.import-preview {
  padding: 12px;
  border: 1px solid #fedf89;
  border-radius: 8px;
  background: #fffaeb;
  color: #7a4e00;
  line-height: 1.4;
}

.auth-message.success,
.import-preview.success {
  border-color: #abefc6;
  background: #ecfdf3;
  color: #067647;
}

.auth-message.error,
.import-preview.error {
  border-color: #fecdca;
  background: #fef3f2;
  color: #b42318;
}

.review-table-wrap {
  overflow-x: auto;
}

.review-table-wrap table input {
  min-width: 120px;
}

.review-actions {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

@media (max-width: 1080px) {
  .app-shell,
  .coach-layout,
  .umpire-layout,
  .rating-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .calendar-weekdays,
  .calendar-grid {
    grid-template-columns: repeat(7, minmax(62px, 1fr));
  }
}

@media (max-width: 720px) {
  main,
  .sidebar,
  .auth-panel {
    padding: 18px;
  }

  .topbar,
  .section-heading,
  .panel-header {
    display: grid;
  }

  .topbar-actions > *,
  .panel-actions > *,
  .dialog-actions > *,
  .form-grid,
  .import-workspace {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .calendar-weekdays,
  .calendar-grid {
    grid-template-columns: repeat(7, minmax(40px, 1fr));
    padding: 0 10px;
  }

  .calendar-day {
    min-height: 88px;
    padding: 5px;
  }

  .calendar-event {
    font-size: 0.68rem;
    padding: 4px;
  }
}
