html {
  font-size: 15px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  background: #f5f7f3;
  color: #162119;
  display: flex;
  flex-direction: column;
}

body > .container {
  flex: 1 0 auto;
}

.navbar {
  background: #ffffff !important;
}

.navbar-brand {
  font-weight: 700;
}

.view-as-toggle {
  border: 1px solid #cdd7c9;
  border-radius: 6px;
  margin-right: 6px;
  padding-inline: 10px !important;
  color: #116466 !important;
  font-weight: 600;
}

.view-as-toggle:hover {
  background: #eef7f3;
  border-color: #116466;
}

.profile-nav {
  gap: 4px;
}

.profile-nav .nav-link {
  border-radius: 6px;
}

.profile-settings-panel {
  max-width: 720px;
}

.footer {
  flex-shrink: 0;
  margin-top: auto;
  width: 100%;
  white-space: nowrap;
  line-height: 60px;
}

.dashboard-hero {
  min-height: 320px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  padding: 48px;
  background: linear-gradient(rgba(7, 41, 24, .78), rgba(7, 41, 24, .78)), url("https://images.unsplash.com/photo-1595435934249-5df7ed86e1c0?auto=format&fit=crop&w=1600&q=80");
  background-size: cover;
  background-position: center;
  color: white;
}

.dashboard-hero h1 {
  max-width: 680px;
  font-size: 2.8rem;
  line-height: 1.1;
}

.dashboard-hero p {
  max-width: 620px;
}

.eyebrow {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: .08em;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.quick-links a,
.page-panel {
  background: white;
  border: 1px solid #dce4d8;
  border-radius: 8px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
}

.quick-links strong,
.quick-links span {
  display: block;
}

.quick-links span {
  color: #5c665b;
  margin-top: 6px;
}

.narrow {
  max-width: 680px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.week-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.booking-window-help {
  margin: 4px 0 0;
  color: #53645f;
  font-size: .95rem;
}

.booking-date-picker {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: -8px 0 12px;
}

.booking-date-picker label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #53645f;
  font-size: .9rem;
}

.booking-date-picker .form-control {
  min-height: 34px;
  width: 150px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.booking-date-picker .form-select {
  min-height: 34px;
  min-width: 190px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.stacked-form {
  display: grid;
  gap: 10px;
}

.stacked-form .btn {
  justify-self: start;
  margin-top: 8px;
}

.readonly-profile-box {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.readonly-profile-value {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid #d6e4d4;
  border-radius: 8px;
  background: #f7fbf6;
}

.readonly-profile-value span {
  color: #60705f;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.settings-grid label:not(.form-check) {
  display: grid;
  gap: 5px;
}

.settings-wide {
  grid-column: 1 / -1;
}

.settings-check {
  margin: 0;
  align-self: center;
}

.compact-settings-grid {
  grid-template-columns: 140px minmax(220px, 1fr) auto;
}

.user-court-access {
  border: 1px solid #dce4d8;
  border-radius: 8px;
  padding: 14px;
}

.user-court-access legend {
  float: none;
  width: auto;
  padding: 0 4px;
  font-size: 1rem;
  font-weight: 700;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(14, minmax(76px, 1fr));
  gap: 6px;
}

.schedule-grid.court-matrix-grid {
  grid-template-columns: 1fr;
  overflow-x: visible;
  align-items: start;
  gap: 12px;
}

.schedule-message {
  grid-column: 1 / -1;
  background: #ffffff;
  border: 1px solid #dce4d8;
  border-radius: 8px;
  padding: 20px;
  color: #5c665b;
}

.day-column {
  background: white;
  border: 1px solid #dce4d8;
  border-radius: 8px;
  padding: 6px;
  min-width: 0;
  position: relative;
}

.day-column.booking-window-boundary {
  border-left: 4px solid #f0a02f;
}

.day-column.outside-booking-window {
  border-color: #e4d8bf;
}

.day-column h2 {
  display: grid;
  gap: 1px;
  font-size: .76rem;
  line-height: 1.08;
  text-transform: capitalize;
  margin-bottom: 6px;
  min-height: 45px;
}

.day-column h2 span:last-child {
  font-weight: 600;
  color: #4f5c58;
}

.window-badge {
  justify-self: start;
  align-self: end;
  margin-top: 3px;
  padding: 2px 5px;
  border-radius: 999px;
  background: #e8f3e7;
  color: #2d6b32;
  font-size: .63rem;
  font-weight: 700;
  text-transform: none;
  white-space: nowrap;
}

.booking-window-boundary .window-badge,
.outside-booking-window .window-badge {
  background: #fff2d9;
  color: #8a5b13;
}

.slot-list {
  display: grid;
  gap: 4px;
}

.court-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  align-items: start;
}

.court-column {
  display: grid;
  gap: 4px;
  align-content: start;
  min-width: 0;
}

.court-column-title {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  margin: 0;
  color: #27322b;
  font-size: .64rem;
  font-weight: 700;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.court-column-title img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: 0 0 auto;
  background: #fff;
  border-radius: 3px;
}

.court-matrix-grid .day-column {
  min-width: 0;
}

.court-matrix-grid .day-column h2 {
  min-height: 36px;
}

.court-matrix-grid .slot-tile {
  min-height: 28px;
  font-size: .72rem;
}

.slot-tile-form {
  margin: 0;
}

.slot-tile {
  width: 100%;
  min-height: 34px;
  border: 1px solid #cdd7c9;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .84rem;
  line-height: 1;
  transition: transform .08s ease, box-shadow .08s ease, filter .08s ease;
  position: relative;
}

.slot-tile.available {
  background: #2b722d;
  border-color: #2b722d;
  color: #ffffff;
  cursor: pointer;
}

.slot-tile.available:hover {
  filter: brightness(1.08);
  box-shadow: 0 2px 8px rgba(22, 33, 25, .16);
  transform: translateY(-1px);
}

.slot-tile.busy {
  background: #e9ecef;
  border-color: #d3d8de;
  color: #a0a8b0;
  cursor: not-allowed;
}

.slot-tile.busy[title*="Optaget"],
.slot-tile.busy[title*="Træning"] {
  background: #d8d8d8;
  color: #8a8f94;
}

.slot-tile.planned {
  background: #f4a340;
  border-color: #f4a340;
  color: #ffffff;
  cursor: pointer;
}

.slot-tile.booked {
  background: #116466;
  border-color: #116466;
  color: #ffffff;
  cursor: pointer;
}

.slot-tile.failed {
  background: #d94f45;
  border-color: #d94f45;
  color: #ffffff;
  cursor: default;
}

.slot-tile.pending-payment {
  background: #d8a028;
  border-color: #d8a028;
  color: #ffffff;
  cursor: default;
}

.slot-state-icon {
  width: 13px;
  height: 13px;
  position: absolute;
  right: 5px;
  bottom: 5px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.slot-repeat-icon {
  width: 13px;
  height: 13px;
  position: absolute;
  left: 5px;
  bottom: 5px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.booking-source-info {
  margin: 12px 0 4px;
  padding: 10px 12px;
  border: 1px solid #d8e2d4;
  border-radius: 8px;
  background: #f7faf6;
  color: #304139;
  font-size: .95rem;
}

.booking-player-summary {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #dce4d8;
  border-radius: 8px;
  background: #fbfcfb;
}

.booking-player-summary > span {
  display: block;
  margin-bottom: 8px;
  color: #5c665b;
  font-size: .9rem;
  font-weight: 700;
}

.booking-player-summary div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.booking-player-summary div span {
  padding: 5px 9px;
  border-radius: 999px;
  background: #e9f3ec;
  color: #1e5d2b;
  font-size: .92rem;
  font-weight: 700;
}

.hover-tooltip {
  position: fixed;
  z-index: 1200;
  max-width: min(360px, calc(100vw - 24px));
  padding: 10px 12px;
  border: 1px solid #cdd7c9;
  border-radius: 8px;
  background: #ffffff;
  color: #10221c;
  box-shadow: 0 12px 32px rgba(17, 36, 29, .18);
  font-size: .92rem;
  line-height: 1.3;
  pointer-events: none;
}
.action-links {
  display: flex;
  justify-content: end;
  gap: 10px;
  align-items: center;
}

.action-links form {
  display: inline;
}

.action-links .btn-link {
  padding: 0;
  vertical-align: baseline;
}

.status-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e9ecef;
}

.status-pill.booket {
  background: #d8f3dc;
}

.status-pill.planlagt,
.status-pill.forventet {
  background: #ffe0ad;
  color: #6b3a00;
}

.status-pill.fejlet {
  background: #f8d7da;
}

.status-pill.afventerbetaling {
  background: #fff3cd;
  color: #6b4b00;
}

.status-pill.annulleret {
  background: #dbeafe;
}

.status-pill.igang {
  background: #ffd18a;
  color: #5a3200;
}

.icon-button {
  width: 30px;
  height: 30px;
  border: 1px solid #cdd7c9;
  border-radius: 6px;
  background: #ffffff;
  color: #2b722d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button:hover {
  background: #f1faed;
  border-color: #2b722d;
}

.stop-button {
  color: #b42318;
}

.stop-button:hover {
  background: #fff1f0;
  border-color: #d92d20;
}

.icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 24, 22, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  padding: 16px;
}

.confirm-backdrop.d-none {
  display: none;
}

.loading-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(18, 24, 22, .36);
}

.loading-backdrop.d-none {
  display: none;
}

.loading-dialog {
  width: min(380px, 100%);
  background: #ffffff;
  border: 1px solid #dce4d8;
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(22, 33, 25, .24);
  padding: 24px;
  text-align: center;
}

.loading-dialog h2 {
  font-size: 1.25rem;
  margin: 14px 0 6px;
}

.loading-dialog p {
  color: #5c665b;
  margin: 0;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 4px solid #dce4d8;
  border-top-color: #116466;
  border-radius: 50%;
  margin: 0 auto;
  animation: loading-spin .8s linear infinite;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.progress-dialog {
  width: min(520px, 100%);
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(22, 33, 25, .24);
  border: 1px solid #dce4d8;
  padding: 24px;
}

.progress-steps {
  list-style: none;
  display: grid;
  gap: 10px;
  margin: 22px 0 0;
  padding: 0;
}

.progress-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #657061;
}

.progress-steps li::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 2px solid #cdd8ca;
  border-radius: 50%;
  background: #ffffff;
}

.progress-steps li.active {
  color: #162119;
  font-weight: 700;
}

.progress-steps li.active::before {
  border-color: #116466;
  box-shadow: 0 0 0 3px rgba(17, 100, 102, .16);
}

.progress-steps li.done::before {
  border-color: #2e7d32;
  background: #2e7d32;
  box-shadow: inset 0 0 0 4px #ffffff;
}

.progress-steps li.failed {
  color: #b42318;
}

.progress-steps li.failed::before {
  border-color: #e2483d;
  background: #e2483d;
  box-shadow: inset 0 0 0 4px #ffffff;
}

.confirm-dialog {
  width: min(420px, 100%);
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(22, 33, 25, .24);
  border: 1px solid #dce4d8;
  padding: 22px;
}

.confirm-dialog h2 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.booking-dialog {
  width: min(720px, 100%);
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(22, 33, 25, .24);
  border: 1px solid #dce4d8;
  padding: 24px;
  position: relative;
}

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

.booking-dialog h2 {
  font-size: 1.3rem;
  margin: 0 0 4px;
}

.booking-dialog p {
  color: #5c665b;
  margin: 0;
}

.modal-inner-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, .86);
  border-radius: 8px;
  text-align: center;
  padding: 24px;
}

.modal-inner-loading.d-none {
  display: none;
}

.modal-inner-loading h3 {
  font-size: 1.15rem;
  margin: 8px 0 0;
}

.modal-inner-loading p {
  max-width: 320px;
}

.booking-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.player-picker {
  border: 1px solid #dce4d8;
  border-radius: 8px;
  padding: 14px;
  margin-top: 18px;
  background: #fbfcfb;
}

.player-picker-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}

.player-picker h3 {
  font-size: 1rem;
  margin: 0 0 2px;
}

.player-picker p,
#player-picker-status {
  color: #5c665b;
  font-size: .9rem;
  margin: 0;
}

.player-picker-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, .55fr);
  gap: 12px;
  margin-top: 10px;
}

.player-list,
.selected-player-list {
  border: 1px solid #dce4d8;
  border-radius: 6px;
  background: #ffffff;
  max-height: 220px;
  overflow: auto;
  padding: 6px;
}

.player-row,
.selected-player {
  width: 100%;
  border: 0;
  border-radius: 5px;
  background: transparent;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  text-align: left;
}

.player-row:hover:not(:disabled),
.selected-player:hover {
  background: #edf5ed;
}

.player-row:disabled {
  color: #9aa4a0;
}

.player-row svg,
.selected-player svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.selected-player {
  color: #116466;
  font-weight: 700;
}

.player-empty {
  color: #6b756b;
  padding: 8px;
}

.booking-form-grid label,
.recurrence-until {
  display: grid;
  gap: 5px;
  color: #5c665b;
}

.recurrence-toggle {
  border: 1px solid #dce4d8;
  border-radius: 6px;
  background: #f4f6f3;
  color: #162119;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  margin-top: 18px;
}

.recurrence-toggle.active {
  background: #e7f1ff;
  border-color: #86b7fe;
  color: #0b5ed7;
}

.recurrence-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.recurrence-panel {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.recurrence-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.recurrence-number {
  width: 76px;
}

.recurrence-unit {
  width: 130px;
}

.weekday-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.weekday-picker button {
  width: 42px;
  height: 38px;
  border: 1px solid #dce4d8;
  border-radius: 4px;
  background: #f4f6f3;
  color: #162119;
  font-weight: 700;
}

.weekday-picker button.active {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #ffffff;
}

.recurrence-patterns {
  display: grid;
  gap: 8px;
}

.recurrence-patterns label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #5c665b;
}

.recurrence-patterns input {
  width: 20px;
  height: 20px;
}

.recurrence-until-row {
  display: flex;
  gap: 8px;
}

.recurrence-until-row input {
  min-width: 0;
}

.action-button-group {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.booking-log-table {
  font-size: .9rem;
}

.booking-log-table > :not(caption) > * > * {
  padding: .35rem .45rem;
}

.booking-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font-size: .9rem;
}

.court-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.court-logo {
  width: 42px;
  height: 28px;
  object-fit: contain;
  border: 1px solid #dce4d8;
  border-radius: 4px;
  background: #fff;
}

@media (max-width: 760px) {
  .page-panel {
    padding: 14px;
  }

  .page-panel h2 {
    font-size: 1.35rem;
  }

  .booking-log-table {
    display: block;
    margin-bottom: 14px;
    border-collapse: separate;
    border-spacing: 0;
  }

  .booking-log-table thead {
    display: none;
  }

  .booking-log-table tbody {
    display: grid;
    gap: 10px;
  }

  .booking-log-table tr {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    border: 1px solid #dce4d8;
    border-radius: 8px;
    padding: 10px;
    background: #ffffff;
  }

  .booking-log-table > :not(caption) > * > * {
    border-bottom: 0;
    padding: 0;
  }

  .booking-log-table td {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: .88rem;
  }

  .booking-log-table td::before {
    content: attr(data-label);
    color: #5c665b;
    font-weight: 700;
  }

  .booking-log-table td[data-field="message"] {
    line-height: 1.3;
  }

  .booking-log-table td[data-field="action"] {
    align-items: center;
  }

  .booking-log-table td[data-field="action"]:empty {
    display: none;
  }

  .booking-log-table td[data-field="action"] .action-button-group,
  .booking-log-table td[data-field="action"] form {
    justify-self: start;
  }

  .booking-pagination {
    justify-content: space-between;
    gap: 8px;
  }

  .booking-pagination .btn {
    padding: .28rem .5rem;
  }
}

@media (max-width: 640px) {
  .dashboard-hero {
    padding: 28px;
  }

  .dashboard-hero h1 {
    font-size: 2rem;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .week-actions {
    justify-content: flex-start;
  }

  .schedule-grid {
    overflow-x: auto;
    padding-bottom: 8px;
  }

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