:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --panel-alt: #eef5ff;
  --text: #122033;
  --muted: #586981;
  --line: #dfe7f4;
  --primary: #1f6feb;
  --primary-dark: #144ea7;
  --success: #1b9c6d;
  --danger: #d64045;
  --warning: #f09d2d;
  --shadow: 0 18px 45px rgba(18, 32, 51, 0.1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(31, 111, 235, 0.1), transparent 28%),
    linear-gradient(180deg, #edf4ff 0%, #f8fafc 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  background: transparent;
}

.sidebar {
  width: 260px;
  flex: 0 0 260px;
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  background: linear-gradient(180deg, #0f1d38 0%, #172c4a 100%);
  color: white;
  padding: 28px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.05);
  overflow: hidden;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
  color: #fff;
}

.brand-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin-bottom: 4px;
}

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

.brand small {
  color: #78a8ff;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.sidebar-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-toggle {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: white;
  cursor: pointer;
  font-size: 1rem;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
}

.nav {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.nav-link {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 12px;
  transition: all 0.2s ease;
  font-weight: 600;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(120, 168, 255, 0.18);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}

.nav-dropdown summary {
  list-style: none;
  cursor: pointer;
}

.nav-dropdown summary::-webkit-details-marker {
  display: none;
}

.nav-dropdown summary::after {
  content: '\25BE';
  float: right;
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.nav-dropdown[open] summary::after {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 4px 0 0 12px;
}

.nav-dropdown-menu .nav-link {
  padding: 9px 12px;
  font-size: 0.92rem;
}

.sidebar,
.main-content {
  transition: width 0.2s ease, padding 0.2s ease;
}

.sidebar-collapsed .sidebar {
  width: 82px;
  flex-basis: 82px;
  padding-left: 12px;
  padding-right: 12px;
}

.sidebar-collapsed .sidebar-topline {
  flex-direction: column;
  align-items: center;
}

.sidebar-collapsed .brand {
  align-items: center;
  font-size: 1.25rem;
}

.sidebar-collapsed .brand-logo {
  width: 42px;
  height: 42px;
}

.sidebar-collapsed .db-status-mini {
  display: none;
}

.sidebar-collapsed .brand small {
  display: none;
}

.sidebar-collapsed .nav-link {
  position: relative;
  height: 42px;
  padding: 11px 0;
  text-align: center;
  font-size: 0;
}

.sidebar-collapsed .nav-link::after {
  content: attr(data-short);
  font-size: 0.9rem;
  font-weight: 800;
}

.sidebar-collapsed .nav-dropdown summary::after {
  display: none;
}

.sidebar-collapsed .nav-dropdown-menu {
  display: none;
}

.sidebar-collapsed .nav-link:hover::before {
  content: attr(data-label);
  position: absolute;
  left: 58px;
  top: 50%;
  z-index: 20;
  transform: translateY(-50%);
  padding: 8px 10px;
  border-radius: 7px;
  background: #0f1d38;
  color: white;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(18, 32, 51, 0.2);
  pointer-events: none;
}

.user-panel {
  padding: 14px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.profile-avatar {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: #78a8ff;
  color: #0f1d38;
  font-size: 0.82rem;
  font-weight: 800;
}

.profile-details {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.profile-details strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-details span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
}

.sidebar-collapsed .user-panel {
  align-items: center;
  padding: 10px;
}

.sidebar-collapsed .profile-details,
.sidebar-collapsed .user-panel-action {
  display: none;
}

.user-panel-action {
  align-self: flex-start;
  border: 0;
  background: transparent;
  color: #b8d1ff;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  padding: 4px 0 0;
  text-decoration: underline;
}

.user-panel-action:hover {
  color: white;
}

.logout-button {
  width: 100%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.logout-button:hover {
  background: rgba(255, 255, 255, 0.14);
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: 36px;
  max-width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 26px;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(1.9rem, 3vw, 2.5rem);
  letter-spacing: -0.04em;
}

.fixture-count-card {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: auto;
  padding: 12px 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f5f8fd 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(18, 32, 51, 0.08);
}

.page-header:has(.fixture-count-card) {
  justify-content: flex-start;
  gap: 8px;
}

.page-header > .fixture-count-card {
  margin-left: 0;
}

.page-header > .fixture-count-card:nth-child(2) {
  margin-left: 0;
}

.fixture-count-card div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 76px;
  padding: 0 14px;
}

.fixture-count-card div + div {
  border-left: 1px solid var(--line);
}

.fixture-count-card strong {
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
}

.fixture-count-card span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fixture-count-card[aria-label="Fixture summary"] strong:first-child {
  color: var(--primary);
}

.fixture-count-card[aria-label="Pitch allocation summary"] strong:first-child {
  color: var(--success);
}

.fixture-count-card[aria-label="Pitch allocation summary"] strong:last-of-type {
  color: var(--warning);
}

@media (max-width: 1100px) {
  .page-header {
    flex-wrap: wrap;
  }

  .fixture-count-card {
    margin-left: 0;
  }
}

.fixture-filter {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 18px;
}

.fixture-filter label {
  width: 190px;
}

.report-filter {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.report-filter label {
  width: 180px;
}

.report-panel {
  max-width: 850px;
}

.report-results-panel {
  max-width: none;
}

.pitch-usage-group + .pitch-usage-group {
  margin-top: 28px;
}

.pitch-usage-group h3 {
  margin: 0 0 10px;
  color: var(--primary-dark);
  font-size: 0.95rem;
}

@media print {
  .sidebar,
  .page-header,
  .fixture-filter,
  .fixture-modal,
  .save-tooltip,
  .action-buttons,
  .referee-icon {
    display: none !important;
  }

  .main-content {
    padding: 0;
  }

  .panel {
    border: 0;
    box-shadow: none;
  }
}

.fixture-modal {
  width: min(720px, calc(100% - 32px));
  max-height: min(720px, calc(100vh - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(18, 32, 51, 0.24);
  color: var(--text);
}

.fixture-modal::backdrop {
  background: rgba(18, 32, 51, 0.42);
}

.fixture-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.fixture-modal-header h2 {
  margin: 0;
}

.calendar-modal {
  width: min(1000px, calc(100% - 32px));
}

.calendar-controls {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.fixture-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.calendar-heading,
.calendar-day {
  min-height: 82px;
  padding: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.calendar-heading {
  min-height: auto;
  background: var(--panel-alt);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.calendar-day.empty {
  background: #f9fbff;
}

.calendar-day strong {
  display: block;
  margin-bottom: 5px;
}

.calendar-day span {
  display: block;
  margin-top: 3px;
  padding: 3px 4px;
  border-radius: 4px;
  background: rgba(31, 111, 235, 0.1);
  color: var(--primary-dark);
  font-size: 0.68rem;
  line-height: 1.25;
}

.modal-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.fixture-date-picker {
  max-width: 260px;
  margin-bottom: 16px;
}

.fixture-day-summary {
  margin: -6px 0 14px;
  color: var(--muted);
  font-size: 0.86rem;
}

.fixture-modal input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.fixture-selection-summary {
  margin: 0 0 14px;
  color: var(--muted);
}

.fixture-no-teams {
  margin: 14px 0 0;
  color: var(--muted);
}

.populate-update-button {
  margin-top: 18px;
}

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

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

.db-status-mini {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  margin: 0;
  border-radius: 7px;
  background: rgba(27, 156, 109, 0.08);
  border: 1px solid rgba(27, 156, 109, 0.2);
  color: var(--text);
  font-size: 0.62rem;
  line-height: 1.15;
}

.db-status-mini.connected {
  background: rgba(27, 156, 109, 0.12);
  border-color: rgba(27, 156, 109, 0.35);
  color: #126d4d;
}

.db-status-mini.disconnected {
  background: rgba(214, 64, 69, 0.08);
  border-color: rgba(214, 64, 69, 0.2);
  color: #9d2a2d;
}

.db-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(27, 156, 109, 0.12);
}

.db-status-mini.connected .db-status-dot,
.db-status-banner.connected .db-status-dot {
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(27, 156, 109, 0.12);
}

.db-status-mini.disconnected .db-status-dot,
.db-status-banner.disconnected .db-status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 2px rgba(214, 64, 69, 0.12);
}

.db-status-message {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 2px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.stat-card {
  background: var(--panel);
  padding: 22px 24px;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.accent-blue {
  border-top: 4px solid var(--primary);
}

.accent-green {
  border-top: 4px solid var(--success);
}

.accent-purple {
  border-top: 4px solid #6f5ce7;
}

.stat-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-card strong {
  font-size: 2.2rem;
}

.panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(153, 170, 194, 0.22);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 22px;
  backdrop-filter: blur(4px);
}

.form-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.form-section h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  color: var(--text);
}

.date-check-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-check-wrap input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.date-check-wrap input[type="date"] {
  flex: 1;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-header h2 {
  margin: 0;
}

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

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.fixtures-table {
  font-size: 12px;
}

th, td {
  padding: 15px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: rgba(31, 111, 235, 0.03);
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: rgba(31, 111, 235, 0.025);
}

.fixtures-table th:nth-child(6),
.fixtures-table td:nth-child(6) {
  min-width: 190px;
  white-space: nowrap;
}

.fixtures-table td:nth-child(6) .inline-edit-form {
  min-width: 170px;
}

.fixtures-table th:nth-child(7),
.fixtures-table td:nth-child(7) {
  min-width: 145px;
}

.fixtures-table td:nth-child(7) .inline-edit-form {
  min-width: 125px;
}

.fixtures-table td:nth-child(7) input[type="time"] {
  width: 92px;
  padding-left: 8px;
  padding-right: 8px;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.certification-panel {
  margin-bottom: 24px;
}

.cert-total-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(31, 111, 235, 0.08);
  border: 1px solid rgba(31, 111, 235, 0.18);
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cert-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.cert-summary-item {
  border-radius: 14px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  background: #f9fbff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.cert-summary-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(18, 32, 51, 0.08);
}

.cert-summary-item span {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cert-summary-item strong {
  font-size: 2rem;
}

.cert-summary-item.green {
  border-color: rgba(27, 156, 109, 0.2);
  background: rgba(27, 156, 109, 0.06);
}

.cert-summary-item.green strong {
  color: var(--success);
}

.cert-summary-item.amber {
  border-color: rgba(240, 157, 45, 0.25);
  background: rgba(240, 157, 45, 0.06);
}

.cert-summary-item.amber strong {
  color: var(--warning);
}

.cert-summary-item.red {
  border-color: rgba(214, 64, 69, 0.2);
  background: rgba(214, 64, 69, 0.06);
}

.cert-summary-item.red strong {
  color: var(--danger);
}

.certification-line {
  line-height: 1.7;
}

.certification-line.valid {
  color: #1f8f4e;
  font-weight: 600;
}

.certification-line.warning {
  color: #d97706;
  font-weight: 700;
}

.certification-line.expired {
  color: #d62828;
  font-weight: 700;
}

.teams-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.search-form input {
  min-width: 260px;
  width: 260px;
}

.inline-edit-form {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 220px;
}

.inline-edit-form input {
  min-width: 0;
  width: 100%;
  padding: 8px 10px;
}

.inline-edit-form select {
  min-width: 0;
  width: 100%;
  padding: 8px 10px;
}

.inline-edit-form select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.kickoff-end {
  color: var(--muted);
  white-space: nowrap;
}

.inline-edit-form .button {
  flex-shrink: 0;
}

.save-tooltip {
  position: fixed;
  top: 24px;
  left: 50%;
  z-index: 10;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--success);
  color: white;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 12px 26px rgba(18, 32, 51, 0.2);
  transform: translateX(-50%);
  animation: save-tooltip-display 5s ease forwards;
}

@keyframes save-tooltip-display {
  from {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.results-summary {
  color: var(--muted);
  font-size: 0.9rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 8px 18px rgba(18, 32, 51, 0.06);
}

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

.button-primary {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}

.button-primary:hover {
  background: linear-gradient(180deg, #2b79ff 0%, #123f8b 100%);
}

.button-secondary {
  background: linear-gradient(180deg, #f0f6ff 0%, #e9f0fb 100%);
  color: var(--text);
  border: 1px solid rgba(31, 111, 235, 0.1);
}

.button-danger {
  background: rgba(214, 64, 69, 0.08);
  color: var(--danger);
  border: 1px solid rgba(214, 64, 69, 0.12);
}

.button-small {
  padding: 8px 10px;
  font-size: 0.82rem;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(214, 64, 69, 0.12);
  border-radius: 9px;
  cursor: pointer;
  font-size: 1rem;
}

.referee-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(31, 111, 235, 0.18);
  border-radius: 8px;
  background: rgba(31, 111, 235, 0.08);
  color: var(--primary-dark);
  cursor: pointer;
  font-size: 0.9rem;
}

.referee-icon:hover {
  background: rgba(31, 111, 235, 0.16);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(31, 111, 235, 0.08);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 600;
  font-size: 0.74rem;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: min(100%, 430px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-header {
  margin-bottom: 20px;
}

.login-logo {
  display: block;
  width: 92px;
  height: 92px;
  object-fit: contain;
  margin: 0 auto 20px;
  border-radius: 16px;
}

.auth-header h1 {
  margin: 0;
  font-size: 2rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.app-version {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
}

.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  background: var(--panel-alt);
  border-radius: 12px;
}

.login-tab {
  border: 0;
  border-radius: 9px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.login-tab.active {
  background: var(--panel);
  color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(18, 32, 51, 0.08);
}

.logo-upload {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 20px;
}

.logo-upload-title {
  margin: 0 0 10px;
  font-weight: 700;
}

.logo-upload-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.logo-upload-form input {
  width: 100%;
  padding: 8px;
  background: #f9fbff;
}

.logo-upload small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
}

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

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(31, 111, 235, 0.5);
  box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.08);
}

.form-panel {
  max-width: 900px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.user-email-field {
  grid-column: span 2;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 8px;
}

.checkbox-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fbff;
  font-weight: 500;
}

.checkbox-option input {
  margin: 0;
}

.user-security-section {
  grid-column: 1 / -1;
}

.user-security-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.multi-select-dropdown {
  min-height: 140px;
  padding: 10px 12px;
  width: 100%;
}

.team-collapsible-wrap {
  display: flex;
  flex-direction: column;
}

.team-js-select {
  position: relative;
  width: 100%;
}

.team-dropdown-label {
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text);
}

.team-dropdown-toggle {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fbff;
  color: var(--text);
  font: inherit;
  text-align: left;
  padding: 12px 14px;
  cursor: pointer;
  position: relative;
}

.team-dropdown-toggle::after {
  content: "▾";
  position: absolute;
  right: 14px;
  top: 12px;
  color: var(--muted);
}

.team-dropdown-menu {
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(18, 32, 51, 0.12);
  padding: 10px;
  max-height: 260px;
  overflow-y: auto;
}

.team-search-wrap {
  margin-bottom: 8px;
}

.team-search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  background: #f9fbff;
}

.team-option-item {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.team-option-item:hover {
  background: rgba(31, 111, 235, 0.04);
}

.team-option-item input {
  margin: 0;
}

.team-option-item span {
  order: 2;
}

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

.form-actions {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.alert {
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 18px;
  font-weight: 600;
}

.alert-danger {
  background: rgba(214, 64, 69, 0.08);
  border: 1px solid rgba(214, 64, 69, 0.18);
  color: var(--danger);
}

.alert-success {
  background: rgba(27, 156, 109, 0.08);
  border: 1px solid rgba(27, 156, 109, 0.18);
  color: var(--success);
}

.demo-credentials {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-basis: auto;
    position: static;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .nav {
    flex: none;
    overflow: visible;
  }

  .stats-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .user-email-field {
    grid-column: auto;
  }

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

  .main-content {
    padding: 22px 18px 30px;
  }

  .page-header {
    align-items: flex-start;
  }

  .fixture-filter,
  .report-filter {
    align-items: stretch;
  }

  .fixture-filter label,
  .report-filter label {
    width: min(100%, 240px);
  }

  .fixture-modal {
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }
}

@media (max-width: 600px) {
  .sidebar {
    padding: 18px 14px 16px;
  }

  .sidebar-topline {
    align-items: center;
  }

  .brand {
    font-size: 1.4rem;
  }

  .brand-logo {
    width: 56px;
    height: 56px;
  }

  .brand-mark-row {
    gap: 6px;
  }

  .db-status-mini {
    max-width: 112px;
  }

  .main-content {
    padding: 18px 12px 24px;
  }

  .page-header,
  .panel-header,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header {
    margin-bottom: 18px;
  }

  .page-header h1 {
    font-size: 1.8rem;
  }

  .page-header > .button,
  .form-actions .button,
  .report-filter .button,
  .fixture-filter .button {
    width: 100%;
    text-align: center;
  }

  .fixture-count-card {
    width: 100%;
    overflow-x: auto;
  }

  .fixture-count-card div {
    min-width: 70px;
    padding: 0 10px;
  }

  .fixture-filter,
  .report-filter {
    flex-direction: column;
    gap: 10px;
  }

  .fixture-filter label,
  .report-filter label {
    width: 100%;
  }

  .panel {
    padding: 16px;
    border-radius: 12px;
  }

  .table-wrap {
    margin-right: -16px;
    padding-right: 16px;
  }

  .fixture-modal {
    width: calc(100% - 20px);
    padding: 18px;
    border-radius: 12px;
  }

  .fixture-modal-header {
    margin-bottom: 14px;
  }

  .user-security-grid {
    grid-template-columns: 1fr;
  }

  .team-dropdown-menu {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 12px;
    max-height: 55vh;
  }
}
