/* Golf Planner — styled to match MtG Consultancy (mtgconsultancy.com):
   monochrome editorial, Archivo, hairline borders, single red accent. */
:root {
  --ink: #0a0a0a;
  --panel: #141414;
  --paper: #ffffff;
  --paper-2: #fafafa;
  --paper-3: #f7f7f6;
  --grey: #9c9c9c;
  --grey-dark: #5c5c5c;
  --hairline: #e7e7e7;
  --hairline-dark: #262626;
  --accent: #d40511;      /* Mind the Gap red */
  --accent-dark: #b30410;
  --radius: 4px;
  --shadow: 0 1px 2px rgba(10,10,10,.05), 0 10px 30px rgba(10,10,10,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Archivo', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 300;
  line-height: 1.7;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: var(--ink); text-decoration: none; }

.kicker { text-transform: uppercase; letter-spacing: .18em; font-size: 11px; font-weight: 600; color: var(--grey-dark); }
.admin-tag { display: inline-block; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); border: 1px solid var(--accent); border-radius: 3px; padding: 1px 5px; vertical-align: middle; }
.topbar .admin-tag { color: #fff; border-color: var(--accent); background: var(--accent); }

/* ---------- Auth screens ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--ink);
  background-image:
    linear-gradient(var(--hairline-dark) 1px, transparent 1px),
    linear-gradient(90deg, var(--hairline-dark) 1px, transparent 1px);
  background-size: 64px 64px;
}
.auth-card {
  width: 100%;
  max-width: 430px;
  background: var(--paper);
  border-radius: var(--radius);
  border-top: 3px solid var(--accent);
  box-shadow: var(--shadow);
  padding: 38px 36px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 18px; letter-spacing: -0.01em; color: var(--ink);
}
.brand .ball { font-size: 20px; }
.auth-card h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin: 22px 0 6px; }
.auth-card p.sub { color: var(--grey-dark); margin: 0 0 22px; font-size: 14px; }

.field { margin-bottom: 16px; }
.field label { display: block; text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 600; color: var(--grey-dark); margin-bottom: 7px; }
.field input {
  width: 100%; padding: 12px 13px; border: 1px solid var(--hairline);
  border-radius: var(--radius); font-size: 15px; font-family: inherit; outline: none; background: var(--paper);
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(10,10,10,.06); }

.btn {
  width: 100%; padding: 13px 18px; border: 1px solid var(--ink); border-radius: var(--radius);
  background: var(--ink); color: #fff; font-weight: 500; font-size: 14px; letter-spacing: .01em;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: #000; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--hairline); }
.btn.secondary:hover { border-color: var(--ink); background: var(--paper-2); }
.btn.danger { background: var(--accent); border-color: var(--accent); }
.btn.danger:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.tiny { width: auto; padding: 8px 14px; font-size: 12.5px; }

.switch { text-align: center; margin-top: 20px; font-size: 14px; color: var(--grey-dark); }
.switch button { background: none; border: none; color: var(--ink); font-weight: 600; border-bottom: 1px solid var(--accent); padding: 0 1px 1px; }

.err { background: #fdeaea; color: var(--accent-dark); border: 1px solid #f6cccd; padding: 10px 12px; border-radius: var(--radius); font-size: 13.5px; margin-bottom: 16px; }
.ok  { background: var(--paper-3); color: var(--ink); border: 1px solid var(--hairline); padding: 10px 12px; border-radius: var(--radius); font-size: 13.5px; margin-bottom: 16px; }

.qr { text-align: center; margin: 8px 0 16px; }
.qr img { width: 190px; height: 190px; border-radius: var(--radius); border: 1px solid var(--hairline); }
.secret-line {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--paper-3); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 9px 10px; font-size: 13px; text-align: center; word-break: break-all; margin-bottom: 18px; color: var(--grey-dark);
}
.code-input input {
  letter-spacing: 10px; text-align: center; font-size: 22px; font-weight: 600;
}

/* ---------- App shell ---------- */
.topbar {
  height: 64px; background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; position: sticky; top: 0; z-index: 30;
  border-bottom: 1px solid var(--hairline-dark);
}
.topbar .brand { color: #fff; }
.topbar .brand .ball { filter: grayscale(0.1); }
.topbar .who { display: flex; align-items: center; gap: 14px; font-size: 14px; color: #e7e7e7; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: transparent;
  border: 1px solid rgba(255,255,255,.35);
  display: grid; place-items: center; font-weight: 600; color: #fff; font-size: 12px;
}
.link-btn { background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; padding: 7px 13px; border-radius: var(--radius); font-size: 12.5px; letter-spacing: .02em; transition: border-color .12s; }
.link-btn:hover { border-color: #fff; }

.container { max-width: 1080px; margin: 0 auto; padding: 30px 22px 70px; }

.cal-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; gap: 14px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--hairline); }
.cal-head h2 { margin: 4px 0 0; font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.cal-nav { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius); border: 1px solid var(--hairline);
  background: var(--paper); font-size: 18px; display: grid; place-items: center; color: var(--ink);
  transition: border-color .12s, background .12s;
}
.icon-btn:hover { background: var(--paper-2); border-color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }
.dow { text-align: left; font-size: 11px; font-weight: 600; color: var(--grey-dark); padding: 10px 10px; text-transform: uppercase; letter-spacing: .14em; background: var(--paper-3); border-bottom: 1px solid var(--hairline); }
.dow + .dow, .day { border-left: 1px solid var(--hairline); }
.dow:nth-child(7n+1) { border-left: none; }
.day {
  background: var(--paper); border-top: 1px solid var(--hairline);
  min-height: 116px; padding: 9px; display: flex; flex-direction: column; gap: 5px;
  cursor: pointer; transition: background .1s;
}
.day:nth-child(7n+1) { border-left: none; }
.day:hover { background: var(--paper-2); }
.day.other { background: var(--paper-3); color: var(--grey); cursor: default; }
.day.other:hover { background: var(--paper-3); }
.day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.day .num { font-size: 13px; font-weight: 600; color: var(--ink); }
.day.other .num { color: var(--grey); font-weight: 400; }
.day.today .num { color: var(--accent); }
.pill {
  font-size: 11.5px; font-weight: 500; line-height: 1.25;
  background: var(--paper-3); color: var(--ink);
  border: 1px solid var(--hairline); border-left: 2px solid var(--ink);
  border-radius: 2px; padding: 3px 6px; display: flex; justify-content: space-between; gap: 6px;
  white-space: nowrap; overflow: hidden;
}
.pill.full { border-left-color: var(--accent); color: var(--accent-dark); }
.pill .cnt { opacity: .7; font-variant-numeric: tabular-nums; }
.more { font-size: 11px; color: var(--grey-dark); font-weight: 500; }

/* ---------- Day drawer ---------- */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(10,10,10,.5); z-index: 40;
  display: flex; justify-content: flex-end;
}
.drawer {
  width: 100%; max-width: 448px; height: 100%; background: var(--paper-2);
  box-shadow: -8px 0 40px rgba(0,0,0,.25); overflow-y: auto;
  animation: slidein .18s ease;
}
@keyframes slidein { from { transform: translateX(24px); opacity: .5; } to { transform: none; opacity: 1; } }
.drawer-head {
  position: sticky; top: 0; background: var(--ink); color: #fff;
  padding: 20px 22px; display: flex; justify-content: space-between; align-items: center;
  border-bottom: 3px solid var(--accent);
}
.drawer-head h3 { margin: 0; font-size: 17px; font-weight: 500; }
.drawer-head .close { background: none; border: none; color: #fff; font-size: 26px; line-height: 1; }
.drawer-body { padding: 20px 22px 44px; }

.slot-card {
  background: var(--paper); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.slot-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.slot-time { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); font-variant-numeric: tabular-nums; }
.slot-course { font-size: 13px; color: var(--grey-dark); margin-top: 2px; }
.slot-badge { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding: 5px 9px; border-radius: 20px; border: 1px solid var(--hairline); color: var(--grey-dark); white-space: nowrap; font-variant-numeric: tabular-nums; }
.slot-badge.full { border-color: var(--accent); color: var(--accent); }
.slot-notes { font-size: 13px; color: var(--ink); margin: 10px 0 0; background: var(--paper-3); border-radius: var(--radius); padding: 9px 11px; border: 1px solid var(--hairline); }

.roster { list-style: none; margin: 14px 0 0; padding: 14px 0 0; border-top: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 8px; }
.roster li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.roster .avatar { width: 26px; height: 26px; font-size: 11px; background: var(--ink); border: none; color: #fff; }
.roster li.you .name { font-weight: 600; }
.roster li.you .name::after { content: ' — you'; color: var(--accent); font-weight: 500; font-size: 12px; }
.slot-actions { display: flex; gap: 8px; margin-top: 16px; }

.add-toggle { margin: 6px 0 8px; }
.new-slot { background: var(--paper); border: 1px solid var(--ink); border-radius: var(--radius); padding: 18px; }
.new-slot h4 { margin: 0 0 14px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--grey-dark); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.new-slot .field { margin-bottom: 12px; }
.new-slot label { text-transform: uppercase; letter-spacing: .12em; font-size: 11px !important; font-weight: 600; color: var(--grey-dark); }
.new-slot input, .new-slot textarea {
  width: 100%; padding: 10px 11px; border: 1px solid var(--hairline); border-radius: var(--radius); font-size: 14px; background: var(--paper); font-family: inherit; outline: none;
}
.new-slot input:focus, .new-slot textarea:focus { border-color: var(--ink); }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 6px 0 14px; color: var(--ink); }
.checkbox-row input { accent-color: var(--accent); width: 16px; height: 16px; }

.player-select {
  width: 100%; padding: 10px 11px; border: 1px solid var(--hairline); border-radius: var(--radius);
  font-size: 14px; font-family: inherit; background: var(--paper); color: var(--ink); outline: none;
}
.player-select:focus { border-color: var(--ink); }
.player-select:disabled { color: var(--grey); background: var(--paper-3); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500;
  background: var(--paper-3); border: 1px solid var(--hairline); border-left: 2px solid var(--ink);
  border-radius: 3px; padding: 4px 6px 4px 9px; color: var(--ink);
}
.chip button { background: none; border: none; color: var(--grey-dark); font-size: 16px; line-height: 1; padding: 0 2px; cursor: pointer; }
.chip button:hover { color: var(--accent); }

.slot-addrow { margin-top: 12px; }
.slot-addrow:empty { margin-top: 0; }

.roster li { position: relative; }
.roster-x {
  margin-left: auto; background: none; border: none; color: var(--grey);
  font-size: 16px; line-height: 1; padding: 0 4px; cursor: pointer;
}
.roster-x:hover { color: var(--accent); }

.empty { text-align: center; color: var(--grey-dark); padding: 34px 10px; font-size: 14px; border: 1px dashed var(--hairline); border-radius: var(--radius); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: var(--radius);
  font-size: 14px; z-index: 100; box-shadow: var(--shadow); border-left: 3px solid var(--accent);
}
.toast.err { border-left-color: #fff; background: var(--accent); }

@media (max-width: 620px) {
  .day { min-height: 82px; }
  .day .num { font-size: 12px; }
  .pill { font-size: 10px; }
  .cal-head h2 { font-size: 24px; }
}
