/* Palette from the official raca.sk theme and the municipal coat of arms:
   --c-primary-red #D5242A, --c-samosprava #BF152B, --c-zivot #D10C2A,
   --c-dark-gray #404040, --c-text #585858, --c-header-gray #FBFBFB,
   --c-menu-secondary-text #FFF3F3; erb gold #FDDA2A, erb field #CC3026. */
:root {
  --raca-red: #D5242A;
  --raca-red-dark: #BF152B;
  --raca-red-deep: #8E1020;
  --raca-gold: #FDDA2A;
  --bg: #F7F4F2;
  --bg-elev: #FFFFFF;
  --ink: #2A2A2A;
  --muted: #585858;
  --line: #E4DDD8;
  --green: #D5242A;
  --green-dark: #BF152B;
  --green-soft: #FFF3F3;
  --ball: #FDDA2A;
  --taken: #EEEAE6;
  --danger: #9a2f2f;
  --warn: #8a5a10;
  --shadow: 0 10px 30px rgba(80, 16, 24, 0.08);
  --radius: 18px;
  --font: "Open Sans", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1100px 420px at 8% -8%, #FFF3F3 0%, transparent 55%),
    radial-gradient(900px 360px at 100% 0%, #FFF6C4 0%, transparent 46%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.45;
}

a { color: var(--green); }
button, input, select { font: inherit; }

.wrap {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 80px;
}

.admin-wrap { width: min(980px, calc(100% - 32px)); }

.site-masthead {
  background: #fff;
  border-top: 4px solid var(--raca-red);
  border-bottom: 3px solid var(--raca-gold);
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}
.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
}
.site-masthead .wrap { padding-top: 16px; padding-bottom: 16px; }
header.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.erb {
  width: 72px;
  height: auto;
  flex-shrink: 0;
  display: block;
}
.erb-sm { width: 56px; }
.brand-text { min-width: 0; }
@media (max-width: 560px) {
  .erb { width: 56px; }
  .brand .title { font-size: 1rem; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--raca-red-dark);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand h1, .brand .title {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
  font-weight: 700;
  line-height: 1.25;
  color: var(--raca-red-deep);
}

.brand p, .sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff6c8;
  color: var(--warn);
  border: 1px solid #ead889;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}

.card h2, .label {
  margin: 0 0 12px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.courts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

button, .court-btn, .chip, .slot, .btn, .icon-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(213, 36, 42, 0.16);
  -webkit-appearance: none;
  appearance: none;
}
.court-btn, .chip, .slot, .btn, .icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.court-btn {
  text-align: left;
  padding: 14px;
}

.court-btn strong { display: block; font-size: 1rem; }
.court-btn span { display: block; color: var(--muted); font-size: 0.85rem; }
.court-btn .court-owner { margin-top: 2px; }
@media (hover: hover) and (pointer: fine) {
  .court-btn:hover, .chip:hover, .slot.free:hover, .btn:hover { transform: translateY(-1px); }
}
.court-btn.active, .chip.active, .slot.selected {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: #fff;
}
.court-btn.active span { color: #FFD6D8; }

.dates {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.chip {
  min-width: 68px;
  padding: 10px 8px;
  text-align: center;
  flex-shrink: 0;
}
.chip small { display: block; color: inherit; opacity: 0.75; font-size: 0.72rem; }
.chip strong { display: block; font-size: 1rem; }

.hours {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (min-width: 560px) {
  .hours { grid-template-columns: repeat(3, 1fr); }
}

.slot {
  padding: 12px 8px;
  text-align: center;
  font-weight: 600;
}
.slot.free { background: #fff; color: var(--green-dark); border-color: #E8C9CB; }
.slot.taken, .slot.past, .slot.closed {
  background: var(--taken);
  color: #8a8a84;
  cursor: not-allowed;
  font-weight: 500;
}
.slot.taken { text-decoration: line-through; }
.slot.disabled, .slot.closed { opacity: 0.55; cursor: not-allowed; }
.slot.selected, .slot.selected:hover, .slot.selected:active {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: #fff;
  transform: none;
}
.slot-gap {
  grid-column: 1 / -1;
  text-align: center;
  padding: 12px 10px;
  margin: 2px 0;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background:
    repeating-linear-gradient(-45deg, #f3efe6, #f3efe6 8px, #ebe6db 8px, #ebe6db 16px);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  pointer-events: none;
}
.schedule-note { margin: 0 0 12px; }
.duration { flex-wrap: wrap; }
.duration .chip { flex: 1 1 calc(50% - 8px); }
.cancel-box {
  background: var(--green-soft);
  border-radius: 14px;
  padding: 12px 14px;
  text-align: left;
  margin: 16px 0;
  word-break: break-all;
}
.cancel-box code, .code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.duration {
  display: flex;
  gap: 8px;
}
.duration .chip { flex: 1; min-width: 0; }

form .field { margin-bottom: 12px; }
form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}
form input, form select, form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
}
form input:focus, form select:focus, form textarea:focus {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

.summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  background: var(--green-soft);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 8px 0 16px;
}
.summary strong { font-size: 1.15rem; }

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  background: var(--raca-red);
  border-color: var(--raca-red-dark);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.btn.secondary { background: #fff; color: var(--raca-red-dark); border-color: #E4DDD8; width: auto; padding: 10px 14px; font-weight: 600; }
.btn.danger { background: #f6e4e4; border-color: #e2b3b3; color: var(--danger); width: auto; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.error, .notice {
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 12px;
  font-size: 0.92rem;
}
.error { background: #f8eaea; color: var(--danger); }
.notice { background: #FFF3F3; color: var(--raca-red-deep); }

.confirm {
  text-align: center;
  padding: 36px 22px;
}
.confirm .check {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--green-soft);
  display: grid;
  place-items: center;
  font-size: 1.8rem;
}
.confirm h1 { margin: 0 0 8px; font-size: 1.6rem; letter-spacing: -0.03em; }
.confirm dl {
  text-align: left;
  margin: 24px 0;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 12px;
}
.confirm dt { color: var(--muted); }
.confirm dd { margin: 0; font-weight: 600; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.toolbar, .filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin-bottom: 12px;
}
.filters .field { margin: 0; min-width: 140px; flex: 1; }
.muted { color: var(--muted); }
.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--taken);
}
.status-pill.paid { background: var(--green-soft); color: var(--green-dark); }
.status-pill.pending { background: #fff6c8; color: var(--warn); }
.status-pill.blocked { background: #ece8e0; }
.status-pill.cancelled, .status-pill.expired { color: var(--muted); }

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

footer {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
.footer-owner {
  margin: 14px 0 0;
  font-weight: 600;
  color: var(--ink);
}
.footer-owner a { color: var(--raca-red-dark); text-decoration: none; }
.footer-owner a:hover { text-decoration: underline; }
.footer-contact { margin: 6px 0 0; }
.footer-contact a { color: var(--raca-red-dark); text-decoration: none; }
.footer-contact a:hover { text-decoration: underline; }

.hidden { display: none !important; }
.login-box { max-width: 420px; margin: 12vh auto; }

.admin-wrap table { font-size: 0.86rem; }
.admin-wrap th, .admin-wrap td { white-space: nowrap; }
.admin-wrap td:nth-child(3), .admin-wrap td:nth-child(5) { white-space: normal; min-width: 110px; }
#login-hint { margin-bottom: 12px; }

.booking-cards { display: flex; flex-direction: column; gap: 10px; }
.booking-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}
.booking-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 8px;
}
.booking-card h3 { margin: 0; font-size: 1rem; }
.booking-card dl {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 4px 10px;
  margin: 0 0 10px;
  font-size: 0.9rem;
}
.booking-card dt { color: var(--muted); }
.booking-card dd { margin: 0; font-weight: 600; word-break: break-word; }
.booking-card .btn { width: 100%; }
@media (max-width: 720px) {
  .admin-table { display: none; }
}
@media (min-width: 721px) {
  .booking-cards { display: none; }
}

.subhead {
  margin: 28px 0 10px;
  font-size: 1.05rem;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}
.admin-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}
.admin-item header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.admin-item h3 { margin: 0; font-size: 1rem; }
.admin-item p { margin: 4px 0 10px; }
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-actions .btn { width: auto; }
.setup-link-box {
  margin-top: 12px;
  padding: 12px;
  background: var(--green-soft);
  border-radius: 12px;
}
.setup-url {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.setup-url input {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
}
#change-password-form .field { max-width: 420px; }

.mcp-banner {
  margin: 0 0 16px;
  padding: 12px 14px;
  background: var(--green-soft);
  border-radius: 14px;
  font-size: 0.95rem;
  line-height: 1.45;
}
.mcp-url-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  vertical-align: middle;
  margin: 0 2px;
}
.mcp-url-wrap input {
  width: min(100%, 28rem);
  min-width: 12rem;
  flex: 1;
  font-size: 0.85rem;
  padding: 6px 8px;
}
.mcp-url-wrap .btn {
  width: auto;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.booking-card.block-card {
  border-color: #c9b48a;
  background: #fbf7ef;
}
tr.block-row td:first-child { box-shadow: inset 3px 0 0 #c9b48a; }
.status-pill.blocked { background: #efe3c8; color: #6a4f12; }
