:root {
  /* Colours sampled from the Starbug hull in img/logo.png: mid green, bright highlights,
     near-black shadows, a red stripe, and amber for the running lights. */
  --bg: #e4ece0;
  --card: #f7faf4;
  --ink: #15200f;
  --muted: #526a4e;
  --line: #c6d7c1;
  --accent: #3f8a3f;
  --accent-dark: #24461f;
  --accent-ink: #f1f8ec;
  --danger: #c0392b;
  --today: #f0b429;
  --display: "Eurostile Extended", "Eurostile", "Michroma", "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
  color-scheme: light;
}
/* Eurostile, as on the hull. Regular for text, Extended Black for the display pieces. */
@font-face { font-family: "Eurostile"; src: url("fonts/eurostile.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Eurostile Extended"; src: url("fonts/eurostile-extended-black.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.45 "Eurostile", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
button, input, select { font: inherit; }
a { color: var(--accent-dark); text-underline-offset: 2px; }
h1, h2 { margin: 0; font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
h2 { font-size: 0.9rem; }
.card > h1 { font-size: 1.2rem; }

/* The header is a strip of the hull photo (its top edge has no lettering), darkened so the text reads. */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; color: var(--accent-ink); position: sticky; top: 0; z-index: 2; background: linear-gradient(180deg, rgba(10,22,8,0.35), rgba(10,22,8,0.6)), url("img/logo.jpg") center top / cover no-repeat, var(--accent-dark); box-shadow: 0 1px 0 rgba(0,0,0,0.35); text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand h1 { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand h1 .pre { opacity: 0.75; font-size: 0.7em; margin-right: 6px; }
.bug { display: block; flex: none; color: #c5e38a; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5)); }
.hero { display: block; width: min(100%, 300px); height: auto; margin: 4px auto 12px; border-radius: var(--radius); box-shadow: 0 10px 30px rgba(20,40,16,0.35); }
.who { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; white-space: nowrap; }
.who select { background: rgba(255,255,255,0.12); color: inherit; border: 1px solid rgba(255,255,255,0.3); border-radius: 8px; padding: 6px 8px; }
.who .link { color: inherit; opacity: 0.8; }

main { max-width: 760px; margin: 0 auto; padding: 14px 12px 60px; display: grid; gap: 14px; min-width: 0; }
body { overflow-x: hidden; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.status { font-size: 0.95rem; color: var(--muted); padding: 0 4px; min-height: 1.2em; }
.status strong { color: var(--ink); }

.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cal-head h2 { flex: 1; text-align: center; }
.icon { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 1.2rem; line-height: 1; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 6px 8px; text-decoration: underline; text-underline-offset: 2px; }
.weekdays, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays span { text-align: center; font-family: var(--display); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 4px 0; }
.grid { gap: 3px; }
.day { position: relative; min-width: 0; overflow: hidden; min-height: 64px; border-radius: 9px; background: #f3f5e8; border: 1px solid transparent; padding: 4px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 2px; }
.day:hover { border-color: var(--line); }
.day.other { opacity: 0.38; }
.day.past { cursor: default; color: var(--muted); }
.day.today .num { background: var(--today); border-radius: 999px; }
.day.selecting { outline: 2px solid var(--accent); outline-offset: -2px; }
.day .num { font-size: 0.8rem; font-weight: 600; width: 22px; height: 22px; display: grid; place-items: center; }
.day .bar { height: 16px; border-radius: 4px; font-size: 0.7rem; line-height: 16px; padding: 0 5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0 -4px; }
.day .bar.start { margin-left: 0; border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.day .bar.end { margin-right: 0; border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.day .bar.mid { border-radius: 0; color: transparent; }
.day .bar.end:not(.start) { color: transparent; }
.day .bar.free { background: rgba(70, 84, 66, 0.16); color: var(--muted); border-top: 1px dashed var(--member, var(--muted)); border-bottom: 1px dashed var(--member, var(--muted)); line-height: 14px; }
.day .bar.free.start { border-left: 1px dashed var(--member, var(--muted)); }
.day .bar.free.end { border-right: 1px dashed var(--member, var(--muted)); }
.badge { display: inline-block; font-size: 0.7rem; padding: 1px 7px; border-radius: 999px; background: #f5e6b8; color: #6b4e00; vertical-align: middle; margin-left: 6px; }
.badge.ok { background: #d3ebcf; color: #24461f; }
.badge.maybe { background: #e6e3f5; color: #3e3573; }
.hint { margin: 10px 0 0; font-size: 0.85rem; color: var(--muted); }

form { display: grid; gap: 10px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: end; }
label { display: grid; gap: 4px; font-size: 0.85rem; color: var(--muted); }
input[type="date"], input[type="text"], input[type="password"], select { width: 100%; padding: 10px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.nights { font-size: 0.95rem; color: var(--ink); padding-bottom: 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 12px 16px; cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.primary:disabled { opacity: 0.6; cursor: wait; }
.ghost { background: none; border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; cursor: pointer; }
.danger { background: none; border: 1px solid var(--danger); color: var(--danger); border-radius: 10px; padding: 11px 14px; cursor: pointer; margin-left: auto; }
.error { color: var(--danger); margin: 0; min-height: 1.2em; font-size: 0.9rem; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list li { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; padding: 10px 6px; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .dot { width: 10px; height: 10px; border-radius: 50%; }
.list .when { font-weight: 600; }
.list .meta { font-size: 0.85rem; color: var(--muted); }
.list .empty { color: var(--muted); grid-template-columns: 1fr; }
.list button { white-space: nowrap; }

dialog { border: 0; border-radius: var(--radius); padding: 22px; width: min(92vw, 360px); }
dialog::backdrop { background: rgba(20, 25, 22, 0.55); }
dialog form { gap: 10px; }
dialog p { margin: 0; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 520px) {
  .day { min-height: 54px; }
  .day .bar { font-size: 0.62rem; }
  .who label { display: none; }
}

/* ---- sign-in, setup, admin ---- */
.centre { align-content: start; }
.narrow { max-width: 420px; margin: 24px auto 0; width: 100%; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 0.85rem; }
.centre-text { text-align: center; }
.button { display: inline-block; text-decoration: none; text-align: center; }
a.primary { color: var(--accent-ink); }
.names { display: flex; flex-wrap: wrap; gap: 8px; }
.names button { border: 1px solid var(--line); background: #f3f5e8; border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.names button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.who a, .who button.link { color: inherit; opacity: 0.85; }
.inline { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 8px; align-items: center; margin-top: 10px; }
.inline input { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
code { font-family: ui-monospace, Menlo, monospace; font-size: 0.9em; }
.list .actions { display: flex; gap: 6px; }
.approve { background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 8px 12px; cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 0.75rem; text-transform: uppercase; }
.decline, .remove { background: none; border: 1px solid var(--danger); color: var(--danger); border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.badge.maybe { background: #e6e3f5; color: #3e3573; }
@media (max-width: 520px) { .inline { grid-template-columns: 1fr 1fr; } .inline button { grid-column: span 2; } }

/* Attribute hidden must win over the display rules above. */
[hidden] { display: none !important; }
input, select, button { min-width: 0; max-width: 100%; }
.tokenrow { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.tokenrow code { flex: 1; overflow-wrap: anywhere; background: #e8efe0; padding: 8px 10px; border-radius: 8px; font-size: 0.8rem; }
