* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: #f4f4f2; }
body {
  -webkit-font-smoothing: antialiased;
  color: #23262b;
  font-family: 'Instrument Sans', Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}
a { color: #2E7D72; text-decoration: none; }
a:hover { color: #1f5a52; text-decoration: underline; }
input, button, select { font-family: inherit; }
button { font: inherit; }

@keyframes riseIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.mono { font-family: 'JetBrains Mono', monospace; }

/* ---- centered screens (login / band picker) ---- */
.center-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.center-box { width: 100%; animation: riseIn .4s ease both; }
.login-box { max-width: 380px; }
.picker-box { max-width: 460px; }

.eyebrow {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: #8c8f8a; margin-bottom: 10px;
}
h1.title { font-size: 30px; line-height: 1.1; font-weight: 600; margin: 0 0 8px; letter-spacing: -.02em; }
h1.title-sm { font-size: 26px; font-weight: 600; margin: 0 0 6px; letter-spacing: -.02em; }
.subtitle { margin: 0 0 26px; color: #6d716c; }

.pw-input {
  width: 100%; padding: 14px 16px; border-radius: 12px; border: 1px solid #dcdcd6;
  background: #fff; font-size: 16px; outline: none; color: #23262b;
}
.pw-error {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #fbe9e5; color: #8f2f1c; font-size: 13px;
}
.btn-primary {
  margin-top: 14px; width: 100%; padding: 14px 16px; border: none; border-radius: 12px;
  background: #23262b; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: #3a3f46; }

.picker-list { display: flex; flex-direction: column; gap: 10px; }
.picker-btn {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 12px;
  border: 1px solid #dcdcd6; background: #fff; cursor: pointer; text-align: left;
  transition: transform .15s; width: 100%;
}
.picker-btn:hover { transform: translateY(-1px); }
.swatch { width: 14px; height: 14px; border-radius: 5px; flex: none; display: inline-block; }
.picker-btn .name { font-weight: 600; }

/* ---- header ---- */
header.topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(244,244,242,.92);
  backdrop-filter: blur(10px); border-bottom: 1px solid #e2e2dc;
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 16px; display: flex; flex-wrap: wrap;
  gap: 10px; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.brand .name { font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand .sub { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #9a9d98; letter-spacing: .1em; text-transform: uppercase; }
/* Content-sized first, so it still wraps below the brand on narrow screens,
   then grows to fill that line so the settings button can sit at its end. */
.topbar-right { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: 6px; align-items: center; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px;
  cursor: pointer; font-size: 13px; font-weight: 600; border: 1px solid #dcdcd6; background: #fff; color: #6d716c;
}
.chip.active { border-color: transparent; background: #23262b; color: #fff; }

.btn-outline {
  height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid #dcdcd6; background: #fff;
  cursor: pointer; font-size: 13px; font-weight: 600; color: #4a4e49;
}
.btn-outline:hover { border-color: #23262b; }
.btn-icon { flex: none; }
/* Pushed to the far right so the band chips keep the left edge to themselves. */
.settings-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; }

/* Narrow screens: drop the label so the button stays on the band-chip row
   instead of wrapping onto a line of its own. */
@media (max-width: 640px) {
  .settings-btn { width: 38px; padding: 0; justify-content: center; }
  .settings-btn .btn-label { display: none; }
}

/* ---- main ---- */
main { max-width: 1180px; margin: 0 auto; padding: 16px 16px 64px; }

.cal-topline {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 6px 0 16px;
}
.range-label { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.active-hint { font-size: 13px; color: #7c807a; }
.cal-controls { display: flex; gap: 6px; align-items: center; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid #dcdcd6; background: #fff;
  cursor: pointer; font-size: 16px; color: #4a4e49;
}
.icon-btn:hover { border-color: #23262b; }
.view-tabs { display: flex; background: #e7e7e1; border-radius: 10px; padding: 3px; margin-left: 4px; }
.view-tab {
  padding: 7px 14px; border-radius: 8px; border: none; cursor: pointer; font-size: 13px; font-weight: 600;
  background: transparent; color: #7c807a;
}
.view-tab.active { background: #fff; color: #23262b; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---- week view ---- */
.week-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(152px, 1fr)); gap: 10px; }
.day-card { background: #fff; border: 1px solid #e2e2dc; border-radius: 14px; padding: 12px; }
.day-card.today { border-color: #23262b; }
.day-card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.weekday-label { font-size: 13px; font-weight: 600; color: #4a4e49; }
.date-label { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #9a9d98; padding: 2px 0; border-radius: 6px; }
.date-label.today { color: #fff; background: #23262b; padding: 2px 6px; }
.slots-col { display: flex; flex-direction: column; gap: 8px; }

.slot-btn {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; width: 100%;
  padding: 9px 11px; border-radius: 10px; text-align: left; cursor: pointer;
  transition: background .15s, border-color .15s; min-height: 54px; justify-content: center;
  border: 1px solid transparent; background: none;
}
.slot-btn:hover { filter: brightness(.97); }
.slot-btn .slot-label { font-size: 10px; font-family: 'JetBrains Mono', monospace; letter-spacing: .08em; text-transform: uppercase; opacity: .75; }
.slot-btn .slot-status { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.slot-free { background: #fff; border: 1px dashed #cdcdc6; color: #8c8f8a; }
.slot-mine { }
.slot-pending { background: #8f2f1c !important; color: #fff !important; border-color: transparent !important; }
.slot-other { cursor: not-allowed; padding-left: 9px; }

/* ---- month view ---- */
.weekday-heads { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 6px; }
.weekday-heads span {
  text-align: center; font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: #9a9d98; display: block;
}
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.month-cell {
  display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-height: 64px;
  padding: 7px 6px; border-radius: 10px; cursor: pointer; background: #fff; border: 1px solid #e6e6e0;
  width: 100%; text-align: left;
}
.month-cell.out-of-month { background: #f7f7f5; opacity: .7; }
.month-cell.selected { border-color: #23262b; }
.month-cell .day-num {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; align-self: flex-start; color: #4a4e49;
  padding: 1px 0; border-radius: 5px;
}
.month-cell .day-num.today { color: #fff; background: #23262b; padding: 1px 5px; }
.month-cell .day-num.out-of-month { color: #c2c4bf; }
.month-bars { display: flex; flex-direction: column; gap: 2px; width: 100%; }
.month-bars span { display: block; height: 5px; border-radius: 3px; background: #e7e7e1; }

.day-detail {
  margin-top: 14px; background: #fff; border: 1px solid #e2e2dc; border-radius: 14px; padding: 14px;
  animation: riseIn .25s ease both;
}
.day-detail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.day-detail-head .title { font-weight: 600; }
.close-x { border: none; background: none; color: #8c8f8a; font-size: 18px; cursor: pointer; line-height: 1; }
.day-detail-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }

.legend { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 12px; color: #7c807a; }
.legend .item { display: flex; align-items: center; gap: 6px; }
.legend .box { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.legend .box.free { border: 1px dashed #c8c8c1; background: #fff; }
/* .box.mine / .box.other get their colours inline, from the active band. */

/* ---- settings ---- */
.settings-wrap { animation: riseIn .3s ease both; }
.settings-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 18px; }
.settings-title { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.card { background: #fff; border: 1px solid #e2e2dc; border-radius: 14px; padding: 16px; }
.card-title { font-weight: 600; margin-bottom: 4px; }
.card-desc { font-size: 13px; color: #7c807a; margin-bottom: 12px; }

.halftime-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #ecece6;
  border-radius: 10px; background: #fcfcfa; margin-bottom: 8px;
}
.halftime-row:last-child { margin-bottom: 0; }
.halftime-badge {
  width: 22px; height: 22px; flex: none; display: flex; align-items: center; justify-content: center;
  border-radius: 7px; background: #23262b; color: #fff; font-size: 11px; font-weight: 600;
}
.halftime-name { font-size: 14px; font-weight: 600; }
.halftime-time { margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: 13px; color: #4a4e49; }

.band-rows { display: flex; flex-direction: column; gap: 10px; }
.band-row { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid #ecece6; border-radius: 12px; background: #fcfcfa; }
.band-row-top { display: flex; gap: 8px; align-items: center; }
.color-input { width: 40px; height: 40px; padding: 2px; border: 1px solid #dcdcd6; border-radius: 10px; background: #fff; cursor: pointer; flex: none; }
.name-input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid #dcdcd6; background: #fff; font-size: 14px; outline: none; color: #23262b; }
.del-btn { flex: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid #ecdcd8; background: #fff; color: #a8503a; cursor: pointer; }
.del-btn:hover { background: #fbe9e5; }

.fixed-label { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #9a9d98; margin-bottom: 6px; }
.fixed-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.fixed-col { display: flex; flex-direction: column; gap: 3px; }
.fixed-col-label { text-align: center; font-size: 11px; color: #7c807a; }
.fixed-cell {
  width: 100%; padding: 6px 0; border-radius: 7px; font-size: 11px; font-weight: 600; line-height: 1;
  border: 1px solid #dcdcd6; background: #fff; color: #9a9d98; cursor: pointer;
}
.fixed-cell.mine { border-color: transparent; }
.fixed-cell.other { cursor: not-allowed; border-color: #e6e6e0; color: #6d716c; }

.add-band-btn {
  margin-top: 14px; padding: 10px 14px; border-radius: 10px; border: 1px dashed #c8c8c1; background: none;
  color: #4a4e49; font-size: 13px; font-weight: 600; cursor: pointer; width: 100%;
}
.add-band-btn:hover { border-color: #23262b; }

.history-list { display: flex; flex-direction: column; }
.history-item { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid #efefe9; }
.history-item:first-child { border-top: none; }
.history-dot { width: 9px; height: 9px; border-radius: 999px; flex: none; margin-top: 6px; background: #c8c8c1; }
.history-text { display: block; font-size: 14px; }
.history-time { display: block; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #9a9d98; margin-top: 2px; }

/* ---- toast ---- */
.toast-wrap { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60; animation: toastIn .25s ease both; max-width: 92vw; }
.toast { padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.16); color: #fff; }
.toast.ok { background: #23262b; }
.toast.error { background: #8f2f1c; }
.toast.info { background: #4a4e49; }

.app-loading { min-height: 100vh; display: flex; align-items: center; justify-content: center; color: #8c8f8a; }
