/* Palette & type from the Mischief Managed site (Elementor kit 262). */
:root {
  --teal: #489FA1;
  --teal-dark: #37807f;
  --teal-pale: #C8DEDD;
  --plum: #8E4B92;
  --plum-dark: #733a77;
  --cream: #F6EEEE;
  --ink: #202020;
  --text: #606060;
  --line: #e4d9d9;
  --white: #fff;
  --danger: #b3261e;
  --away: #7d7373;
  --hour: 48px;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(32, 32, 32, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--text);
  font: 16px/1.5 "Nunito", system-ui, sans-serif;
}
h1, h2, h3 {
  font-family: "Calistoga", Georgia, serif;
  font-weight: normal;
  color: var(--teal);
  letter-spacing: -.4px;
  margin: 0 0 .5em;
  line-height: 1.2;
}
h1 { font-size: 34px; }
h2 { font-size: 26px; }
h3 { font-size: 20px; color: var(--ink); }
a { color: var(--plum); }
[hidden] { display: none !important; }
.muted { color: #8a8080; }
.small { font-size: 13px; }
.error { color: var(--danger); font-weight: 600; }

/* ---------- chrome ---------- */
.topbar {
  background: var(--plum);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 6px 4%;
}
.topbar button {
  background: none; border: 0; color: #fff; font: inherit; text-decoration: underline; cursor: pointer; padding: 0 0 0 8px;
}
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--white);
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 8px 24px;
  padding: 10px 4%;
}
.logo img { height: 44px; width: auto; display: block; }
nav { display: flex; flex-wrap: wrap; gap: 4px; }
nav a {
  font-weight: 800; font-size: 14px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
  padding: 8px 14px; border-radius: 50px;
}
nav a:hover { color: var(--teal); }
nav a.active { background: var(--teal); color: #fff; }

main { max-width: 1280px; margin: 0 auto; padding: 24px 4% 64px; }

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 800 13px/1 "Nunito", sans-serif; letter-spacing: 1px; text-transform: uppercase;
  background: var(--plum); color: #fff;
  border: 2px solid var(--plum); border-radius: 50px;
  padding: 11px 22px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover, .btn:focus-visible { background: var(--plum-dark); border-color: var(--plum-dark); }
.btn.teal { background: var(--teal); border-color: var(--teal); }
.btn.teal:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn.ghost { background: transparent; color: var(--plum); }
.btn.ghost:hover { background: var(--cream); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.sm { padding: 7px 14px; font-size: 11px; }
.btn:disabled { opacity: .5; cursor: default; }

label { display: block; font-weight: 700; color: var(--ink); font-size: 14px; margin-bottom: 12px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px;
  font: 16px "Nunito", sans-serif; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal-pale); border-color: var(--teal); }
input:disabled, select:disabled, textarea:disabled { background: var(--cream); color: var(--text); cursor: not-allowed; }
input[type=checkbox] { display: inline; width: auto; margin: 0 6px 0 0; }
input[type=color] { padding: 2px; height: 38px; width: 60px; }
.inline { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.inline label { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.spacer { flex: 1; }

.seg { display: inline-flex; background: var(--white); border-radius: 50px; box-shadow: var(--shadow); padding: 3px; }
.seg button {
  font: 800 12px "Nunito", sans-serif; letter-spacing: 1px; text-transform: uppercase;
  border: 0; background: none; color: var(--ink); padding: 8px 14px; border-radius: 50px; cursor: pointer;
}
.seg button.on { background: var(--teal); color: #fff; }

/* ---------- login ---------- */
.login { max-width: 400px; margin: 40px auto; }
.login .switch { margin-top: 12px; font-size: 14px; }

/* ---------- calendar ---------- */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
/* Fixed width so the arrows don't shift as the date text changes length. */
.cal-toolbar .cal-title { margin: 0 4px 0 0; font-size: 26px; width: 330px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav .btn.sm { min-width: 38px; }
.cal-toolbar input[type=date] { width: 150px; margin: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 14px; font-weight: 700; color: var(--ink); margin: 0 0 14px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* The calendar scrolls in its own frame so day headers and the time column stay in view. */
.cal-scroll {
  overflow: auto; overscroll-behavior: contain;
  max-height: max(420px, calc(100vh - 250px));
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
}
.cal { display: grid; min-width: 100%; }
.cal-head { position: sticky; top: 0; background: var(--white); border-bottom: 1px solid var(--line); padding: 8px 4px 6px; text-align: center; z-index: 2; }
.cal-head .day { font-weight: 800; color: var(--ink); }
.cal-head .day.today { color: var(--plum); }
.cal-head.corner { left: 0; z-index: 4; }
.cal-times { border-right: 1px solid var(--line); position: sticky; left: 0; z-index: 3; background: var(--white); }
.cal-times div { height: var(--hour); font-size: 12px; text-align: right; padding: 0 6px; transform: translateY(-8px); color: #8a8080; }
.cal-col { position: relative; border-left: 1px solid var(--line); cursor: copy;
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--hour) - 1px), var(--line) calc(var(--hour) - 1px) var(--hour));
}
.cal-col.today { background-color: #fbf7f7; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--plum); z-index: 3; pointer-events: none; }

.ev {
  position: absolute; border-radius: 6px; padding: 3px 5px; overflow: hidden;
  font-size: 12px; line-height: 1.25; color: #fff; cursor: pointer; z-index: 1;
  box-shadow: 0 1px 2px rgba(0,0,0,.2); border: 1px solid rgba(0,0,0,.1);
}
.ev b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev span { opacity: .9; }
.ev.mine { outline: 2px solid var(--ink); outline-offset: -2px; }
/* Bookwhen classes: diagonal stripes over the venue colour (set via background-color inline). */
.ev.from-bw { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.32) 0 5px, transparent 5px 10px); }
.ev.away { opacity: .92; }
table.classes select { width: auto; max-width: 220px; margin: 0; padding: 6px 8px; font-size: 14px; }
.ev.noblock { opacity: .75; border: 1px dashed rgba(0,0,0,.35); box-shadow: none; }
.allday {
  margin-top: 3px; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; text-align: left;
  color: #fff; background: var(--c); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.allday.noblock { background: transparent; color: var(--ink); border: 1px dashed var(--c); }
.ev.clash { outline: 3px solid var(--danger); outline-offset: -1px; z-index: 2; }
.legend .bw i { background: #8a8080 repeating-linear-gradient(135deg, rgba(255,255,255,.45) 0 2px, transparent 2px 4px); }
.who-field { margin-bottom: 12px; }
.who-label { display: block; font-weight: 700; color: var(--ink); font-size: 14px; margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--teal-pale); color: var(--ink); border-radius: 50px; padding: 4px 12px; font-size: 14px; font-weight: 700; }
.chip button { border: 0; background: none; font-size: 16px; line-height: 1; cursor: pointer; color: var(--ink); padding: 0 0 0 2px; }
#bf-who-add { margin-top: 8px; max-width: 260px; }
.bw-note { background: var(--cream); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 0 0 14px; }
.feed { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(200px, 2fr) auto; gap: 10px 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.feed input { margin: 0; font-size: 13px; color: var(--text); }
details { margin: 12px 0; }
details p { margin: 6px 0; }
.status { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; background: var(--cream); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }

/* ---------- lists & tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 800; color: var(--ink); font-size: 12px; text-transform: uppercase; letter-spacing: .8px; border-bottom: 2px solid var(--line); padding: 8px; }
td { border-bottom: 1px solid var(--line); padding: 8px; vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; padding: 2px 8px; border-radius: 50px; background: var(--teal-pale); color: var(--ink); }
.tag.plum { background: #e8d6e9; }
.tag.red { background: #f5d5d2; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.tile { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; border-top: 5px solid var(--teal); }
.tile .big { font-family: "Calistoga", serif; font-size: 34px; color: var(--ink); line-height: 1.1; }
.tile .lbl { font-weight: 800; color: var(--ink); }
.bar { height: 8px; background: var(--cream); border-radius: 8px; margin-top: 10px; overflow: hidden; }
.bar > div { height: 100%; border-radius: 8px; }

/* ---------- dialog ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(32, 32, 32, .45); }
dialog form { padding: 22px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 50px; font-weight: 700; z-index: 100;
  max-width: calc(100vw - 32px);
}

@media (max-width: 640px) {
  :root { --hour: 44px; }
  main { padding: 16px 16px 48px; }
  .topbar { padding: 6px 16px; }
  .site-header { padding: 8px 16px; }
  .logo img { height: 34px; }
  nav a { padding: 6px 10px; font-size: 12px; }
  h1 { font-size: 28px; }
  .grid2 { grid-template-columns: 1fr; }
  .feed { grid-template-columns: 1fr; }

  /* Calendar on phones */
  .site-header { position: static; }
  nav { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  nav a { white-space: nowrap; }
  .cal-toolbar { gap: 8px; margin-bottom: 10px; }
  .cal-toolbar .cal-title { width: 100%; font-size: 22px; margin: 0; }
  .cal-nav { flex: 1; }
  .cal-nav .btn.sm { padding: 10px 14px; font-size: 13px; min-width: 44px; }
  .cal-toolbar input[type=date] { width: auto; flex: 1; min-width: 0; font-size: 15px; padding: 8px; }
  .seg button { padding: 10px 14px; }
  .toolbar-spacer, .cal-toolbar .spacer { display: none; }
  .wide-only { display: none; }
  .legend { gap: 6px 12px; font-size: 12px; margin-bottom: 10px; }
  .cal-scroll { max-height: max(360px, calc(100dvh - 200px)); border-radius: 10px; }
  .cal-times div { font-size: 11px; padding: 0 4px; }
  .cal-head { padding: 6px 2px 4px; }
  .cal-head .day { font-size: 14px; }
  .ev { font-size: 11px; padding: 2px 4px; }
  /* "+ New booking" becomes a floating button */
  .new-btn {
    position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 30;
    width: 56px; height: 56px; padding: 0; border-radius: 50%; box-shadow: 0 4px 14px rgba(0,0,0,.3);
  }
  .new-btn .plus { font-size: 28px; line-height: 1; font-weight: 400; }
  .new-btn .label { display: none; }
  dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  dialog form { padding: 16px; }
}
