/* De Volharding crew planner
   Palette: poured concrete, factory brick red (the website's agenda dot),
   stage amber and a stage-light green for availability. */
:root {
  --bg: #EFF0EC;
  --panel: #FFFFFF;
  --ink: #23292B;
  --muted: #667070;
  --line: #CFD3CD;
  --red: #C8322B;
  --red-ink: #7E1E19;
  --amber: #E2A400;
  --amber-ink: #6E4E00;
  --green: #2E8B57;
  --green-ink: #145333;
  --grey-fill: #DADDD8;
  --focus: #1F5FBF;
  --radius: 4px;
  --tap: 44px;
  font-family: 'Archivo', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
}
h1, h2, h3 {
  font-stretch: 112%;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 .5rem;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; margin-top: 1.75rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--red-ink); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1rem;
  background: var(--panel);
  border-bottom: 3px solid var(--red);
}
.wordmark {
  display: flex; align-items: baseline; gap: .5rem;
  text-decoration: none; color: var(--ink);
  font-stretch: 112%; font-weight: 800; font-size: 1.05rem; line-height: 1;
}
.wordmark-dot {
  width: .8em; height: .8em; border-radius: 50%; background: var(--red);
  align-self: center;
}
.wordmark-app { font-weight: 400; font-stretch: 100%; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: .75rem; }
.lang { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lang button {
  border: 0; background: transparent; font: inherit; font-weight: 600;
  padding: .35rem .6rem; cursor: pointer; color: var(--muted);
}
.lang button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---------- tabs ---------- */
.tabs {
  display: flex; gap: 0; overflow-x: auto;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 0 .5rem;
  scrollbar-width: none;
}
.tabs a {
  flex: 0 0 auto;
  padding: .8rem .75rem;
  text-decoration: none; color: var(--muted); font-weight: 600;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
  white-space: nowrap;
}
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

.banner {
  background: #FFF4D6; color: var(--amber-ink);
  border-bottom: 1px solid #EBD28E;
  padding: .6rem 1rem; font-size: .9rem;
}
.banner a { color: inherit; font-weight: 600; }

/* ---------- layout ---------- */
.view { max-width: 62rem; margin: 0 auto; padding: 1.25rem 1rem 5rem; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: .75rem; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem;
}
.auth {
  max-width: 24rem; margin: 3rem auto 0;
}

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
.field { margin-bottom: .9rem; }
.field .help { font-weight: 400; color: var(--muted); font-size: .8rem; margin-top: .2rem; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=time], input[type=url], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  padding: .55rem .65rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; min-height: var(--tap);
}
textarea { min-height: 6rem; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, .day:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 1px;
}
.checks { display: flex; gap: 1rem; flex-wrap: wrap; }
.checks label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .75rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 .75rem; }
@media (max-width: 480px) { .grid3 { grid-template-columns: 1fr 1fr; } }

/* ---------- buttons ---------- */
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: var(--radius); min-height: var(--tap); padding: .5rem 1rem;
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
}
.btn-secondary { background: #fff; color: var(--ink); }
.btn-danger { background: #fff; color: var(--red-ink); border-color: var(--red); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); padding: .4rem .6rem; min-height: 36px; }
.btn-quiet:hover { color: var(--ink); }
.btn-sm { min-height: 34px; padding: .3rem .7rem; font-size: .875rem; }
button:disabled { opacity: .5; cursor: default; }

/* ---------- availability grid: the one loud element ---------- */
.month-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: .5rem 0 .75rem; }
.month-head h2 { margin: 0; font-size: 1.5rem; }
.cal {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.cal .dow { text-align: center; font-size: .75rem; color: var(--muted); font-weight: 600; padding: .25rem 0; }
.day {
  position: relative; min-height: 64px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; cursor: pointer; padding: .35rem;
  display: flex; flex-direction: column; justify-content: space-between;
  font: inherit; color: var(--ink); text-align: left;
  -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.day.pad { visibility: hidden; }
.day.past { opacity: .45; }
.day .n { font-weight: 700; font-size: .95rem; }
.day.today .n { text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 3px; text-underline-offset: 3px; }
.day .st { font-size: .7rem; font-weight: 700; letter-spacing: .02em; line-height: 1; }
.day.available { background: var(--green); border-color: var(--green); color: #fff; }
.day.maybe     { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.day.unavailable { background: var(--grey-fill); border-color: var(--grey-fill); color: var(--muted); }
.day.unavailable .n { text-decoration: line-through; }
.day.has-note::after {
  content: ''; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px;
  border-radius: 50%; background: currentColor;
}
.day .ev {
  position: absolute; bottom: 5px; right: 6px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--red); border: 1.5px solid #fff;
}
@media (min-width: 640px) { .day { min-height: 80px; } .day .st { font-size: .75rem; } }

.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .85rem; margin: .75rem 0; }
.legend span::before {
  content: ''; display: inline-block; width: 12px; height: 12px; border-radius: 3px;
  margin-right: .35rem; vertical-align: -1px; border: 1px solid var(--line); background: #fff;
}
.legend .available::before { background: var(--green); border-color: var(--green); }
.legend .maybe::before { background: var(--amber); border-color: var(--amber); }
.legend .unavailable::before { background: var(--grey-fill); border-color: var(--grey-fill); }
.legend .event::before { background: var(--red); border-color: var(--red); border-radius: 50%; }

/* ---------- events list ---------- */
.evlist { list-style: none; padding: 0; margin: 0; }
.evitem {
  display: grid; grid-template-columns: 3.6rem 1fr auto; gap: .75rem; align-items: start;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .75rem; margin-bottom: .5rem; cursor: pointer;
}
.evitem:hover { border-color: var(--ink); }
.evitem.cancelled { opacity: .55; }
.evdate { text-align: center; line-height: 1; }
.evdate .d { font-size: 1.5rem; font-weight: 800; font-stretch: 112%; display: block; }
.evdate .m { font-size: .7rem; color: var(--muted); font-weight: 600; }
.evtitle { font-weight: 700; font-size: 1.05rem; }
.evmeta { color: var(--muted); font-size: .875rem; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.chip {
  font-size: .75rem; font-weight: 600; padding: .15rem .5rem; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.chip.confirmed { border-color: var(--green); color: var(--green-ink); }
.chip.requested { border-color: var(--amber); color: var(--amber-ink); }
.chip.declined { border-color: var(--line); color: var(--muted); text-decoration: line-through; }
.chip.draft { color: var(--muted); }
.chip.cancelled { color: var(--red-ink); border-color: var(--red); }
.chip.status-confirmed { background: var(--ink); color: #fff; border-color: var(--ink); }
.need { display: flex; gap: .4rem; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.need b { color: var(--ink); }
.need .short b { color: var(--red-ink); }

/* ---------- event detail dialog ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(35,41,43,.45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 20;
}
@media (min-width: 640px) { .overlay { align-items: center; padding: 2rem 1rem; } }
.dialog {
  background: var(--panel); width: 100%; max-width: 44rem; max-height: 92vh; overflow: auto;
  border-radius: var(--radius) var(--radius) 0 0; padding: 1rem 1rem 2rem;
}
@media (min-width: 640px) { .dialog { border-radius: var(--radius); } }
.dialog h1 { font-size: 1.4rem; }
.times { display: grid; grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr)); gap: .5rem; margin: .75rem 0; }
.times div { background: var(--bg); padding: .5rem; border-radius: var(--radius); }
.times .k { font-size: .7rem; color: var(--muted); font-weight: 600; display: block; }
.times .v { font-weight: 700; font-size: 1.1rem; }
pre.notes { white-space: pre-wrap; font: inherit; background: var(--bg); padding: .75rem; border-radius: var(--radius); margin: 0 0 .75rem; }

.filelist, .crewlist { list-style: none; padding: 0; margin: 0 0 .75rem; }
.filelist li, .crewlist li {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .5rem 0; border-bottom: 1px solid var(--line);
}
.filelist li .kind, .crewlist li .disc {
  font-size: .75rem; font-weight: 700; color: var(--muted); min-width: 4.5rem;
}
.crewlist li .who { font-weight: 600; flex: 1; }
.crewlist li .who .me { color: var(--red-ink); font-weight: 400; font-size: .85rem; }
.spacer { flex: 1; }
.av-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 1px solid var(--line); vertical-align: -1px; margin-right: .3rem; }
.av-dot.available { background: var(--green); border-color: var(--green); }
.av-dot.maybe { background: var(--amber); border-color: var(--amber); }
.av-dot.unavailable { background: var(--muted); border-color: var(--muted); }

/* ---------- tables (planner, crew) ---------- */
.tablewrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .55rem .65rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; color: var(--muted); font-weight: 700; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--bg); }
td.num { text-align: center; font-variant-numeric: tabular-nums; }
td.num.short { color: var(--red-ink); font-weight: 700; }
td.num.ok { color: var(--green-ink); font-weight: 700; }
td select, td input { min-height: 34px; padding: .25rem .4rem; font-size: .875rem; }
.inline-check { display: inline-flex; align-items: center; gap: .3rem; }

/* ---------- misc ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: var(--radius);
  font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
  z-index: 30; max-width: calc(100% - 2rem);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red-ink); }
.qr { width: 200px; height: 200px; border: 1px solid var(--line); background: #fff; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; background: var(--bg); padding: .1rem .3rem; border-radius: 3px; word-break: break-all; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------- v2: shifts, role groups ---------- */
.shift { border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: var(--radius); padding: .6rem .75rem; margin-bottom: .5rem; background: #fff; }
.shift.open { border-left-color: var(--amber); }
.shift .short { color: var(--red-ink); font-weight: 700; }
.shift .ok { color: var(--green-ink); font-weight: 700; }
.shift .crewlist { margin: .4rem 0; }
.shift .crewlist li { padding: .3rem 0; }
h3.dept { margin-top: 1rem; color: var(--muted); font-stretch: 100%; font-weight: 600; font-size: .85rem; }
.rolegroup { margin-bottom: .6rem; }
.rolegroup b { display: block; margin-bottom: .2rem; color: var(--muted); }
.chip .x { border: 0; background: transparent; color: inherit; padding: 0 .1rem; min-height: 0; font-weight: 800; cursor: pointer; }
