/* MTQ Run and MTQ Crew: one stylesheet for both sites. Phone first. */

:root {
  --bar: #1c1530;
  --gold: #f3d27a;
  --ink: #111;
  --muted: #6b6b6b;
  --line: #ddd;
  --paper: #fff;
  --col: #f4f2ec;
  --tailer: #E4D598;
  --warn: #d99a00;
  --slow: #c0392b;
  --link: #1a73e8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

button, input, select { font: inherit; }

.hidden { display: none !important; }

/* Top bar and tabs */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bar);
  color: var(--gold);
  padding: calc(10px + env(safe-area-inset-top)) 16px 0;
}
.bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
}
.bar h1 { margin: 0; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .who { font-size: 12px; color: #d8cfa8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .out {
  background: transparent;
  color: var(--gold);
  border: 1px solid rgba(243, 210, 122, .45);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: transparent;
  color: #cfc6a6;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 8px 12px 9px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}
.tabs button.on { color: var(--gold); border-bottom-color: var(--gold); }

.tech-banner {
  background: repeating-linear-gradient(135deg, #f7e6a8 0 14px, #f3dc8c 14px 28px);
  color: #3a3418;
  font-weight: 700;
  text-align: center;
  padding: 7px 12px;
  font-size: 13px;
  border-bottom: 1px solid #d9c26a;
}

main { padding: 12px 14px calc(40px + env(safe-area-inset-bottom)); max-width: 1400px; margin: 0 auto; }
.narrow { max-width: 560px; margin: 0 auto; }

h2 { font-size: 18px; margin: 4px 0 12px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
.lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); font-style: italic; padding: 24px 0; text-align: center; }

/* Buttons and fields */

.btn {
  display: block;
  width: 100%;
  background: var(--bar);
  color: var(--gold);
  border: 0;
  border-radius: 10px;
  padding: 12px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  margin-top: 8px;
}
.btn.nav { background: var(--link); color: #fff; }
.btn.plain { background: #eee; color: var(--ink); font-weight: 600; }
.btn.danger { background: #fbe9e7; color: #8a1f12; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small, .sbtn {
  display: inline-block;
  width: auto;
  padding: 6px 10px;
  font-size: 13px;
  margin: 0 6px 6px 0;
  border-radius: 8px;
}
.sbtn {
  background: #eee;
  color: var(--ink);
  border: 0;
  font-weight: 600;
  cursor: pointer;
}
.sbtn.dark { background: var(--bar); color: var(--gold); }
.sbtn:disabled { opacity: .4; cursor: default; }

label.f { display: block; margin: 0 0 10px; }
label.f > span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 3px; }
input[type=text], input[type=password], input[type=tel], input[type=url], input[type=date], select {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 9px 10px;
  background: #fafafa;
  color: var(--ink);
  font-size: 16px; /* stops iOS zooming on focus */
}
label.check { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; }
label.check input { width: 20px; height: 20px; }

.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  background: #fff;
}
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row .grow { flex: 1; min-width: 0; }
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  border-radius: 8px;
  padding: 1px 7px;
  background: #eee;
  color: #444;
  vertical-align: middle;
}
.tag.live { background: #d9f0d9; color: #1d5e1d; }
.tag.tech { background: #f7e6a8; color: #3a3418; }
.tag.gone { background: #f6d5d0; color: #8a1f12; }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: middle; border: 1px solid rgba(0,0,0,.15); }

/* Login */

.login { max-width: 360px; margin: 40px auto; padding: 0 16px; }
.login img { display: block; width: 96px; height: 96px; border-radius: 22px; margin: 0 auto 12px; }
.login h1 { text-align: center; font-size: 22px; margin: 0 0 18px; color: var(--bar); }
.error { color: #a3271a; font-size: 14px; min-height: 1.4em; margin: 6px 0; }

/* Board */

.board-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.board-head .title { font-weight: 700; }
.toggle { display: inline-flex; border: 1px solid #ccc; border-radius: 8px; overflow: hidden; }
.toggle button { border: 0; background: #fff; padding: 5px 10px; font-size: 13px; cursor: pointer; }
.toggle button.on { background: var(--bar); color: var(--gold); }

.board {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.col {
  min-width: 172px;
  width: 172px;
  flex: 1 0 172px;
  background: var(--col);
  border-radius: 10px;
  padding: 8px;
  scroll-snap-align: start;
  align-self: flex-start;
}
@media (min-width: 900px) {
  .col { min-width: 140px; width: auto; flex: 1 0 140px; }
}
.col.drop-ok { outline: 2px dashed var(--bar); outline-offset: -2px; }
.col h4 { margin: 0 0 2px; font-size: 13px; overflow-wrap: anywhere; }
.col .sub { font-size: 11px; color: #777; margin-bottom: 6px; }
.col .sub a { color: var(--link); text-decoration: none; font-weight: 600; }
.col .free { font-size: 11px; color: #b33; font-style: italic; margin: 2px 0 6px; }
.divider { border-bottom: 1px dashed #ccc; margin: 4px 0 8px; }

.crew {
  border-radius: 8px;
  padding: 5px 6px;
  margin-bottom: 6px;
  color: #222;
  font-size: 12px;
}
.crew .h { font-weight: 700; font-size: 12px; margin-bottom: 3px; display: flex; justify-content: space-between; gap: 6px; }
.crew.can { cursor: pointer; }
.crew .grip { opacity: .55; }
.crew .p { background: rgba(255, 255, 255, .55) !important; }

.chip {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 9px;
  margin: 0 3px 3px 0;
  font-weight: 600;
  color: #222;
  border: 0;
  text-align: left;
  line-height: 1.35;
}
.chip.can { cursor: pointer; }
.chip.can:hover, .crew.can:hover { filter: brightness(.96); }
.chip .late { display: block; font-weight: 500; font-size: 10px; color: #7a2a1a; }
.chip.mine { box-shadow: 0 0 0 2px var(--bar); }
.solo-wrap { margin-bottom: 4px; }

.card {
  background: #fff;
  border-radius: 8px;
  padding: 7px 8px;
  margin-bottom: 6px;
  font-size: 13px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
  overflow-wrap: anywhere;
}
.card .m { font-size: 11px; color: #777; }
.card.warn { border-left: 3px solid var(--warn); }
.card.slow { border-left: 3px solid var(--slow); }
.card.drop-ok { outline: 2px dashed var(--bar); }
.card .tailers { margin-top: 4px; }
.card .pt { font-size: 10px; font-weight: 700; background: #e3ddf3; color: #3d2d6e; border-radius: 6px; padding: 0 5px; margin-left: 4px; }

/* List view */

.list .sect { margin-bottom: 14px; }
.list .sect-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; border-bottom: 2px solid var(--col); padding: 4px 0; }
.list .sect-h b { font-size: 15px; }
.list .sect-h a { color: var(--link); text-decoration: none; font-weight: 600; font-size: 13px; }
.list .item { display: flex; gap: 8px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid #eee; font-size: 14px; }
.list .item .k { font-size: 11px; color: var(--muted); width: 54px; flex: none; padding-top: 2px; }
.list .item .v { flex: 1; min-width: 0; }

/* My spot */

.spot { text-align: center; padding: 18px 12px; border-radius: 14px; background: var(--col); margin-bottom: 14px; }
.spot .where { font-size: 24px; font-weight: 800; margin: 6px 0; overflow-wrap: anywhere; }
.spot .state { font-size: 14px; color: #555; }

.opt {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 11px 12px;
  margin-bottom: 8px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
}
.opt span { display: block; font-weight: 400; font-size: 12px; color: #777; }
.opt:hover { background: #faf8f2; }

/* Modals */

.dim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal {
  background: #fff;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
@media (min-width: 700px) {
  .dim { align-items: center; }
  .modal { border-radius: 16px; }
}
.modal h3 { margin: 0 0 6px; font-size: 17px; }
.modal p { margin: 0 0 12px; color: #444; font-size: 14px; }
.modal.center { text-align: center; }

.toast {
  position: fixed;
  left: 50%;
  top: calc(64px + env(safe-area-inset-top));
  transform: translateX(-50%);
  z-index: 60;
  background: #2a2140;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  max-width: 90vw;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
}
.toast.err { background: #8a1f12; }

/* Tables on the run site */

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px 6px; border-bottom: 1px solid var(--line); }
table.t td { padding: 7px 6px; border-bottom: 1px solid #eee; vertical-align: top; }

.swatches { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 4px 0 10px; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatches button.on { border-color: var(--bar); }
.swatches input[type=color] { width: 40px; height: 32px; border: 0; padding: 0; background: none; }

.loc-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.loc-row .row { margin-bottom: 6px; }

/* Team photos and the team sheet */

.card.can { cursor: pointer; }
.card.can:hover { filter: brightness(.98); }
.card .tn { display: flex; align-items: center; gap: 6px; }
.thumb { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: none; background: #eee; }
.team-photo { display: block; width: 100%; max-height: 50vh; object-fit: contain; border-radius: 12px; background: #f1f1f1; margin: 0 0 10px; }
.no-photo { border: 1px dashed #ccc; border-radius: 12px; padding: 22px 10px; text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.modal h3 .pt { font-size: 11px; font-weight: 700; background: #e3ddf3; color: #3d2d6e; border-radius: 6px; padding: 0 5px; margin-left: 6px; vertical-align: middle; }

/* Messages */

.badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 5px;
  border-radius: 9px;
  background: #c0392b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-style: normal;
  line-height: 18px;
  text-align: center;
  vertical-align: 1px;
}
.thread-row { position: relative; }
.thread-row b { margin-right: 4px; }
.pending-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--warn); vertical-align: 1px; margin-right: 2px; }
.thread-head { display: flex; align-items: center; gap: 8px; }
.thread-head .sbtn { margin: 0; }
.thread-head h2 { margin: 4px 0 8px; overflow-wrap: anywhere; }
.thread-msgs {
  height: 52vh;
  min-height: 200px;
  overflow-y: auto;
  background: var(--col);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.msg { max-width: 82%; align-self: flex-start; background: #fff; border-radius: 12px; padding: 6px 10px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: #e6e0f5; }
.msg .a { font-size: 11px; font-weight: 700; color: #4a3f6b; }
.msg .b { white-space: pre-wrap; }
.msg .t, .req .t { font-size: 10px; color: #888; }
.msg.me .t { text-align: right; }
.msg.sys { align-self: center; background: transparent; box-shadow: none; color: #555; font-size: 12px; font-style: italic; text-align: center; max-width: 95%; }
.req { align-self: stretch; background: #fff; border: 2px solid var(--tailer); border-radius: 12px; padding: 8px 10px; overflow-wrap: anywhere; }
.req .b { font-weight: 700; }
.req .row { margin-top: 6px; }
.req .row .sbtn { margin: 0; }
.req .tag { margin-top: 4px; }
.composer { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.composer .btn { width: auto; margin: 0; padding: 10px 16px; }
textarea.compose {
  flex: 1;
  min-width: 0;
  resize: none;
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 9px 10px;
  background: #fafafa;
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* stops iOS zooming on focus */
}

/* Bottom navigation on the crew site */

.tabs.bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: var(--bar);
  padding: 0 6px env(safe-area-inset-bottom);
  gap: 0;
  border-top: 1px solid rgba(243, 210, 122, .25);
}
.tabs.bottom button {
  flex: 1;
  border-bottom: 0;
  border-top: 3px solid transparent;
  padding: 10px 6px 11px;
}
.tabs.bottom button.on { border-top-color: var(--gold); }
body.has-bottom-nav main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
body.has-bottom-nav .thread-msgs { height: calc(100vh - 330px); height: calc(100dvh - 330px); }
