/* Alcmaria Flames house style (staging.alcmariaflames.nl) */
:root {
  --black: #0C0E12;
  --red: #D5231B;
  --red-dark: #B01C15;
  --gold: #F2B400;
  --slate: #5B6675;
  --line: #C9D1DA;
  --bg: #F3F5F7;
  --surface: #FFFFFF;
  --text: #1A1D23;
  --field-height: 2.5rem;

  /* Status colours: border + fill */
  --match: #1F8A4C;     --match-bg: #E3F4EA;
  --free: #D97706;      --free-bg: #FFF1DC;
  --usage: #2563EB;     --usage-bg: #E6EEFC;
  --tentative: #B58900; --tentative-bg: #FFF9DB;
  --returned: #6B7280;  --returned-bg: #EEF0F3;
  --blocked: #374151;   --blocked-bg: #E2E5EA;
  --rented: #7C3AED;    --rented-bg: #F1EAFD;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 Barlow, system-ui, sans-serif; color: var(--text); background: var(--bg); }
h1, h2, .week-no, .brand, .tile-title { font-family: 'Big Shoulders Display', Barlow, sans-serif; letter-spacing: .01em; }
h1 { font-size: 2rem; margin: 0 0 .75rem; }
h2 { font-size: 1.4rem; margin: 1.5rem 0 .5rem; }
h1 small, h2 small { font-family: Barlow, sans-serif; font-size: .9rem; color: var(--slate); font-weight: 500; }
a { color: var(--red); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
.icon { width: 1.05em; height: 1.05em; vertical-align: -.15em; flex: none; }

/* Top bar */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1.5rem;
  padding: .6rem 16px; background: var(--black); color: #fff; border-bottom: 4px solid var(--red);
}
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-size: 1.6rem; font-weight: 700; }
.brand strong { color: var(--gold); }
.menu { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; }
.menu a, .menu .link { color: #fff; text-decoration: none; font-weight: 600; }
.menu a:hover, .menu .link:hover { color: var(--gold); }
.language { display: inline-flex; border: 1px solid rgba(255,255,255,.35); border-radius: 6px; overflow: hidden; }
.language a { padding: .1rem .45rem; font-size: .8rem; }
.language a.current { background: var(--gold); color: var(--black); }

.content { max-width: 1200px; margin: 0 auto; padding: 1rem 16px 4rem; }
.inline { display: inline; }
.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

/* Cards, messages, small elements */
.card { background: var(--surface); border-radius: 10px; padding: 1.25rem; box-shadow: 0 1px 3px rgba(12,14,18,.08); margin-bottom: 1rem; }
.card.flush { padding: 0; overflow: hidden; }
.narrow { max-width: 720px; margin-left: auto; margin-right: auto; }
.back { max-width: 720px; margin: 0 auto .5rem; }
.msg { padding: .7rem 1rem; border-radius: 8px; margin-bottom: .75rem; font-weight: 500; }
.msg-ok { background: #E3F4EA; color: #14532D; }
.msg-error { background: #FDE4E2; color: #8A1A13; }
.msg-warning { background: #FFF6D6; color: #6B4E00; }
.muted { color: var(--slate); }
.dim { color: var(--slate); font-size: .9em; white-space: nowrap; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: 0 .4rem; border-radius: 4px; background: var(--bg); color: var(--slate); vertical-align: middle; }
.alert { color: var(--red); font-weight: 600; }
.right { text-align: right; }

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

/* Forms: every single-line field has the same height */
.form { display: grid; gap: .75rem; }
.form label, .filters label { display: grid; gap: .2rem; font-weight: 600; font-size: .9rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; }
.wide { grid-column: 1 / -1; }
.buttons { display: flex; gap: .5rem; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem; }
input, select, textarea {
  font: inherit; font-weight: 400; color: var(--text); background: #fff;
  border: 1px solid var(--line); border-radius: 6px; padding: 0 .6rem; width: 100%; min-width: 0; margin: 0;
}
input:not([type=checkbox]):not([type=radio]), select { height: var(--field-height); line-height: normal; }
input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; }
textarea { padding: .5rem .6rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .75rem; display: grid; gap: .3rem; }
.form label.check, label.check { display: flex; align-items: center; gap: .4rem; font-weight: 500; }
.check input { width: auto; height: auto; }
[hidden] { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; height: var(--field-height);
  font: inherit; font-weight: 700; padding: 0 1rem; border: 0; border-radius: 6px;
  background: var(--red); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--red-dark); }
.btn.light { background: #fff; color: var(--black); border: 1px solid var(--line); }
.btn.light:hover { border-color: var(--black); }
.btn.small { height: 2.1rem; padding: 0 .75rem; font-size: .9rem; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem;
  border: 0; border-radius: 6px; background: transparent; color: var(--slate); cursor: pointer; font-size: 1.05rem;
}
.icon-btn:hover { background: var(--bg); color: var(--black); }
.icon-btn.danger:hover { background: #FDE4E2; color: var(--red); }

/* Combobox: free text with suggestions */
.combo { position: relative; display: block; }
.combo-list {
  position: absolute; z-index: 40; top: calc(100% + 2px); left: 0; right: 0; margin: 0; padding: .25rem 0; list-style: none;
  background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.12); max-height: 14rem; overflow-y: auto;
}
.combo-list li { padding: .4rem .6rem; cursor: pointer; font-weight: 400; }
.combo-list li.active, .combo-list li:hover { background: var(--bg); }
.combo-new {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); pointer-events: none;
  font-size: .7rem; font-weight: 700; text-transform: uppercase; padding: .05rem .35rem; border-radius: 4px; background: var(--gold); color: var(--black);
}

/* Tables and rows */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--bg); vertical-align: middle; }
.table th { font-size: .85rem; color: var(--slate); }
.table tr.inactive td { color: var(--slate); }
.rows { display: grid; gap: .4rem; }
.row { display: grid; grid-template-columns: 2fr 90px 1.3fr 90px 110px; gap: .5rem; align-items: center; }
.row-head { font-size: .85rem; font-weight: 600; color: var(--slate); }
.row-new { padding-top: .5rem; border-top: 1px dashed var(--line); }

/* Public fixture list: one table, fixed columns */
.fixture-list { table-layout: fixed; }
.fixture-list .col-date { width: 7.5rem; }
.fixture-list .col-time { width: 5.5rem; font-variant-numeric: tabular-nums; }
.fixture-list .col-team { width: 10rem; }
.fixture-list td { border-bottom: 0; padding: .3rem .75rem; }
.fixture-list tr.new-day td { border-top: 1px solid var(--bg); padding-top: .55rem; }
.fixture-list .week-row th {
  background: var(--black); color: #fff; font-family: 'Big Shoulders Display', Barlow, sans-serif; font-size: 1.1rem; padding: .45rem .75rem;
}
/* Some breathing room above every week except the first (margins don't work on table rows, so a white border). */
.fixture-list tbody + tbody .week-row th { border-top: 1.25rem solid var(--surface); }
.fixture-list tbody:last-child tr:last-child td { padding-bottom: .6rem; }
.fixture-list .week-row small { color: var(--line); font-family: Barlow, sans-serif; font-weight: 500; margin-left: .4rem; }

/* Settings tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.tile { display: grid; gap: .3rem; text-decoration: none; color: var(--text); border: 2px solid transparent; }
.tile:hover { border-color: var(--gold); }
.tile-icon { color: var(--red); font-size: 1.8rem; }
.tile-title { font-size: 1.4rem; font-weight: 700; }

/* Schedule */
.legend { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.legend .slot { display: inline-block; width: auto; padding: .15rem .5rem; font-size: .8rem; cursor: default; }
#earlier { margin-bottom: .75rem; }

.week {
  display: grid; grid-template-columns: 64px 1fr 1fr; gap: .5rem;
  padding: .6rem; margin-bottom: .5rem; background: var(--surface); border-radius: 10px; box-shadow: 0 1px 3px rgba(12,14,18,.06);
}
.week-current { outline: 2px solid var(--gold); }
.week-no { font-size: 1.8rem; font-weight: 800; line-height: 1; color: var(--black); text-align: center; padding-top: .2rem; }
.week-no span { display: block; font-family: Barlow, sans-serif; font-size: .7rem; font-weight: 600; text-transform: uppercase; color: var(--slate); }
.day { display: grid; gap: .3rem; align-content: start; min-width: 0; }
.day-other { grid-column: 2 / -1; padding-top: .4rem; border-top: 1px dashed var(--line); }
.day-head { justify-self: start; background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--slate); cursor: pointer; }
.day-head:hover { color: var(--red); }
.day-name { text-transform: uppercase; color: var(--black); }
.day-today .day-head { color: var(--red); }
/* Fade only the parts (not the whole day), so a popover can still rise above the other slots. */
.day-past .day-head, .day-past .no-ice, .day-past .slot:not(:hover) { opacity: .55; }
.no-ice { font-size: .85rem; color: var(--slate); font-style: italic; }

.slot {
  position: relative; display: grid; grid-template-columns: auto 1fr; gap: .15rem .6rem; width: 100%;
  text-align: left; font: inherit; font-size: .92rem; color: var(--text); cursor: pointer;
  padding: .4rem .6rem; border: 0; border-left: 5px solid; border-radius: 6px;
}
.slot:hover, .slot:focus-visible { box-shadow: inset 0 0 0 100vmax rgba(0,0,0,.04); outline: none; }
/* The hovered slot is lifted above its neighbours, so its popover is never hidden behind them. */
.slot:hover, .slot:focus-within { z-index: 30; }
.slot-time { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.slot-label { min-width: 0; overflow-wrap: anywhere; }

.s-match { border-color: var(--match); background: var(--match-bg); }
.s-free { border-color: var(--free); background: var(--free-bg); }
.s-usage { border-color: var(--usage); background: var(--usage-bg); }
.s-tentatively_released { border-color: var(--tentative); background: var(--tentative-bg); border-left-style: dashed; }
.s-returned { border-color: var(--returned); background: var(--returned-bg); color: var(--slate); }
.s-blocked { border-color: var(--blocked); color: var(--blocked); background: repeating-linear-gradient(135deg, var(--blocked-bg) 0 8px, #EDEFF2 8px 16px); }
.slot.s-blocked .slot-time { text-decoration: line-through; }
.s-rented_out { border-color: var(--rented); background: var(--rented-bg); }

/* Popover on hover */
.popover {
  display: none; position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; width: min(320px, 85vw);
  padding: .6rem .75rem; background: var(--black); color: #fff; border-radius: 8px; font-size: .88rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); cursor: default;
}
.week > .day:nth-child(3) .popover { left: auto; right: 0; }
@media (hover: hover) { .slot:hover .popover { display: block; } }
.popover .dim { color: var(--line); }
.facts { display: grid; gap: .35rem; }
.fact { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

.ice-meter { display: inline-flex; gap: 2px; vertical-align: middle; }
.ice-meter i { width: 7px; height: 12px; border-radius: 2px; background: currentColor; opacity: .2; }
.ice-meter i.on { opacity: 1; }

.load-more { text-align: center; padding: 1rem; color: var(--slate); }

/* Modal with the day sheet */
.modal {
  width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 1.25rem; border: 0; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.modal::backdrop { background: rgba(12,14,18,.55); }
.modal-close { position: sticky; top: 0; float: right; background: none; border: 0; font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--slate); }
.day-sheet h2 { margin-top: 0; }
.slot-card { border-left: 5px solid; border-radius: 8px; padding: .6rem .8rem; margin-bottom: .75rem; display: grid; gap: .5rem; }
.slot-card.selected { box-shadow: 0 0 0 2px var(--gold); }
.slot-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.slot-card-time { font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: 999px; background: rgba(255,255,255,.75); font-size: .85rem; font-weight: 600; }
.chip.light { background: rgba(255,255,255,.45); }
.actions { display: inline-flex; align-items: center; gap: .1rem; margin-left: auto; }
.actions form { display: inline; }
.fact-line { display: flex; align-items: center; gap: .4rem; margin: 0; }
.match-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.match-list > li { background: rgba(255,255,255,.75); border-radius: 6px; padding: .3rem .5rem; }
.match-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; min-height: 2rem; }
.team-chip { font-weight: 700; background: var(--black); color: #fff; border-radius: 4px; padding: .05rem .45rem; font-size: .9rem; }
.opponents { font-weight: 500; }
.editor { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .75rem; }
.match-list .editor { margin-top: .4rem; }
.slot-card > .btn { justify-self: start; }
.day-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 .5rem; }

@media (max-width: 640px) {
  h1 { font-size: 1.6rem; }
  .week { grid-template-columns: 1fr; }
  .week-no { text-align: left; font-size: 1.3rem; }
  .week-no span { display: inline; margin-right: .3rem; }
  .day-other { grid-column: auto; }
  .row { grid-template-columns: 1fr 1fr; }
  .row-head { display: none; }
  .table th, .table td { padding: .4rem .25rem; }
  .fixture-list .col-date { width: 5.2rem; }
  .fixture-list .col-time { width: 4rem; }
  .fixture-list .col-team { width: 6rem; }
  .fixture-list td { padding: .3rem .4rem; }
}

/* Confirmation dialog (replaces the browser's confirm()) */
.confirm-dialog {
  width: min(380px, calc(100vw - 32px)); padding: 1.5rem 1.25rem 1.25rem; border: 0; border-radius: 12px;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.confirm-dialog::backdrop { background: rgba(12,14,18,.55); }
.confirm-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 3rem; height: 3rem;
  border-radius: 50%; background: #FDE4E2; color: var(--red); font-size: 1.5rem;
}
.confirm-message { font-size: 1.05rem; font-weight: 600; margin: .9rem 0 1.25rem; }
.confirm-dialog .buttons { justify-content: center; }
.confirm-dialog .btn { min-width: 8rem; }

/* ---- Phase 2-5: dashboard, officials, payments, reports ---- */
.small { font-size: .85rem; }
.spaced { margin-top: .75rem; }
.lead { font-size: 1.15rem; font-weight: 600; }
.links { margin: .75rem 0 0; font-size: .9rem; }
.tag.warn { background: #FFF1DC; color: #8A4B00; }
.tag.ok { background: var(--match-bg); color: #14532D; }
.table tr.past td { color: var(--slate); }

.dashboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; align-items: start; }
.dashboard .card { margin: 0; }
.dashboard h2 { margin-top: 0; display: flex; align-items: center; gap: .4rem; }
.dashboard .wide-card { grid-column: 1 / -1; }
.card.attention { border-left: 5px solid var(--gold); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.list > li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem .75rem; padding: .45rem 0; border-bottom: 1px solid var(--bg); }
.list > li:last-child { border-bottom: 0; }
.list .buttons { flex-wrap: wrap; }
.list .buttons form, .list form { display: inline; }
.list.compact > li { padding: .2rem 0; }
.big-number { font-size: 2.2rem; font-weight: 800; margin: 0; font-family: 'Big Shoulders Display', Barlow, sans-serif; }
.big-number small { font-family: Barlow, sans-serif; font-size: .95rem; font-weight: 500; color: var(--slate); }
.mini-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.mini-days > div { display: grid; gap: .3rem; align-content: start; }

.officials-badge { display: inline-flex; align-items: center; gap: .2rem; font-size: .78rem; font-weight: 700; padding: 0 .35rem; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.officials-badge.complete { background: var(--match); color: #fff; }
.officials-badge.missing { background: var(--red); color: #fff; }
.officials-row { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .35rem; font-size: .9rem; }
.person-chip { display: inline-flex; align-items: baseline; gap: .3rem; padding: .05rem .5rem; border-radius: 999px; background: #E8EBF0; font-weight: 600; font-size: .88rem; }
.person-chip small { font-weight: 500; color: var(--slate); }
.person-chip.self { background: #E6EEFC; box-shadow: inset 0 0 0 1px var(--usage); }
.person-chip.open { background: #fff; border: 1px dashed var(--red); color: var(--red); }

.assign-card { border-left: 5px solid var(--match); padding: .8rem 1rem; }
.assign-card.has-open { border-left-color: var(--red); }
.assign-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.assign-spots { display: grid; gap: .4rem; }
.spot { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.spot form { display: inline; }
.spot-position { min-width: 7rem; font-size: .85rem; font-weight: 600; color: var(--slate); }
.spot.open select { flex: 1 1 260px; width: auto; }

.availability { display: grid; gap: .3rem; }
.availability-week { font-size: 1.1rem; margin: 1rem 0 .2rem; }
.availability-day { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--bg); }
.choice { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.choice-btn { font: inherit; font-size: .9rem; font-weight: 600; padding: .35rem .7rem; border: 0; background: #fff; color: var(--slate); cursor: pointer; }
.choice-btn + .choice-btn { border-left: 1px solid var(--line); }
.choice-yes.on { background: var(--match); color: #fff; }
.choice-maybe.on { background: var(--gold); color: var(--black); }
.choice-no.on { background: var(--red); color: #fff; }

.confirm-page .btn { min-width: 9rem; }
.pay-person { border-top: 1px solid var(--line); padding-top: .5rem; margin-top: 1rem; }
.pay-person h2 { margin: .25rem 0 .5rem; }
.pay-actions { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; margin-top: .5rem; }
.fee-form { display: inline-flex; align-items: center; gap: .2rem; }
.fee-form input { width: 6rem; text-align: right; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { display: grid; gap: .2rem; margin: 0; }
.stat-label { color: var(--slate); font-weight: 600; font-size: .9rem; }
.stat-value { font-family: 'Big Shoulders Display', Barlow, sans-serif; font-size: 1.9rem; font-weight: 800; }
.legend-chip { display: inline-block; width: auto; padding: .1rem .5rem; font-size: .85rem; cursor: default; }

.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.audit-details { font-family: ui-monospace, Consolas, monospace; font-size: .78rem; color: var(--slate); overflow-wrap: anywhere; }

.print-only { display: none; }
.print-table tr.new-day td { border-top: 2px solid var(--line); }
@media print {
  body { background: #fff; font-size: 11pt; }
  .topbar, .no-print, .msg, .modal, .confirm-dialog, .filters, .btn { display: none !important; }
  .print-only { display: block; }
  .content { max-width: none; padding: 0; }
  .card { box-shadow: none; padding: 0; }
  .table th, .table td { padding: .2rem .4rem; }
}
