:root { --label: 200px; --row: 30px; --ink: #1d2733; --muted: #6b7785; --line: #e3e7ec; --hdr: #f5f7fa; --accent: #c8102e; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 13px/1.3 "Segoe UI", system-ui, sans-serif; color: var(--ink); background: #fff; }
button, select, input { font: inherit; }
button { border: 1px solid #c9d1da; background: #fff; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
button:hover { background: #f0f3f6; }
button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
#top { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 30; }
.brand { font-weight: 700; font-size: 15px; }
.tag { font-weight: 600; font-size: 11px; color: #fff; background: var(--accent); border-radius: 4px; padding: 1px 6px; margin-left: 4px; }
.nav, .views, .tools { display: flex; gap: 6px; align-items: center; }
#rangeLabel { min-width: 170px; text-align: center; font-weight: 600; }
.views button { border-radius: 0; } .views button:first-child { border-radius: 6px 0 0 6px; } .views button:last-child { border-radius: 0 6px 6px 0; }
.pill b { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #e8edf2; margin-left: 4px; }
.pill.warn b { background: #ffd8d8; color: #a00; }
#banner { display: none; padding: 6px 12px; background: #fff6d6; border-bottom: 1px solid #f0dd99; }
#banner.on { display: block; }
main { display: flex; height: calc(100vh - 52px); }
#board { flex: 1; overflow: auto; position: relative; }
#side { width: 330px; border-left: 1px solid var(--line); display: flex; flex-direction: column; background: #fbfcfd; }
#panelTabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); }
#panelTabs button { padding: 3px 8px; font-size: 12px; }
#panel { padding: 10px; overflow: auto; flex: 1; }

/* board grid */
.grid { position: relative; min-width: max-content; }
.hrow { display: flex; position: sticky; top: 0; z-index: 20; background: var(--hdr); border-bottom: 1px solid var(--line); }
.hlabel { width: var(--label); flex: none; position: sticky; left: 0; background: var(--hdr); z-index: 21; padding: 6px 8px; font-weight: 600; border-right: 1px solid var(--line); }
.days { display: flex; }
.dayh { border-left: 1px solid var(--line); text-align: center; padding: 3px 0 2px; cursor: pointer; overflow: hidden; white-space: nowrap; }
.dayh .d { font-weight: 600; } .dayh .w { font-size: 10px; color: var(--muted); }
.dayh.we { background: #eceff3; color: var(--muted); } .dayh.hol { background: #fde8e8; } .dayh.today { background: #fff1c2; }
.dayh.sel { outline: 2px solid var(--ink); outline-offset: -2px; }
.dayh .halves { display: flex; font-size: 9px; color: var(--muted); } .dayh .halves span { flex: 1; }
.group { display: flex; background: #eef2f6; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: #4a5866; }
.group .hlabel { background: #eef2f6; padding: 4px 8px; }
.row { display: flex; border-bottom: 1px solid var(--line); }
.row.drop { background: #eef6ff; }
.label { width: var(--label); flex: none; position: sticky; left: 0; background: #fff; z-index: 10; padding: 4px 8px; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.label .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label .r { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cap { height: 4px; background: #e8edf2; border-radius: 2px; margin-top: 3px; overflow: hidden; }
.cap i { display: block; height: 100%; background: #5b8def; } .cap.over i { background: #d33; }
.track { position: relative; }
.cell { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); }
.cell.we { background: #f4f6f8; } .cell.hol { background: #fdf0f0; } .cell.off { background: repeating-linear-gradient(45deg, #f3e9ff, #f3e9ff 5px, #fff 5px, #fff 10px); }
.cell.pm { border-left: 1px dashed #eef1f4; }
.nowline { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); z-index: 5; pointer-events: none; }

/* bookings */
.blk { position: absolute; height: calc(var(--row) - 6px); border-radius: 5px; padding: 2px 6px; font-size: 11px; line-height: 1.15; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis; cursor: grab; border: 1px solid rgba(0,0,0,.18); box-shadow: 0 1px 1px rgba(0,0,0,.06); touch-action: none; user-select: none; z-index: 6; }
.blk .t { font-weight: 600; } .blk .s { opacity: .8; }
.blk.done { opacity: .62; } .blk.done::after { content: "\2713"; position: absolute; right: 9px; top: 2px; font-size: 10px; }
.blk.tentative { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.55) 0 6px, transparent 6px 12px); font-style: italic; }
.blk.cancelled { opacity: .35; text-decoration: line-through; }
.blk.sel { outline: 2px solid var(--ink); outline-offset: 1px; z-index: 8; }
.blk.clash { box-shadow: 0 0 0 2px #e00 inset; }
.blk.moved { box-shadow: 0 0 0 2px #2a7 inset; }
.blk .grip { position: absolute; right: 0; top: 0; bottom: 0; width: 7px; cursor: ew-resize; }
.ghost { position: fixed; z-index: 100; pointer-events: none; opacity: .85; border-radius: 5px; padding: 3px 8px; font-size: 11px; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.25); white-space: nowrap; }
.ghost .where { display: block; font-weight: 400; font-size: 10px; }

/* side panel */
h3 { margin: 4px 0 8px; font-size: 14px; }
.muted { color: var(--muted); }
.f { display: grid; grid-template-columns: 70px 1fr; gap: 4px 8px; align-items: center; margin-bottom: 8px; }
.f input, .f select { width: 100%; padding: 3px 5px; border: 1px solid #c9d1da; border-radius: 5px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #eef2f6; border: 1px solid #d5dde5; border-radius: 12px; padding: 2px 8px; font-size: 11px; touch-action: none; user-select: none; }
.chip.drag { cursor: grab; }
.chip.busy { background: #ffeaea; border-color: #f2c2c2; }
.chip button { border: 0; background: none; padding: 0 2px; font-size: 12px; line-height: 1; color: #888; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 6px 6px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list li:hover { background: #f0f3f6; }
.qitem { touch-action: none; user-select: none; cursor: grab; border-left: 4px solid #ccc; border-radius: 4px; background: #fff; margin-bottom: 6px; padding: 6px 8px; border: 1px solid var(--line); }
.qitem .t { font-weight: 600; }
.note { font-size: 11px; color: var(--muted); white-space: pre-wrap; margin-top: 6px; }
.btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sub { font-weight: 700; font-size: 11px; text-transform: uppercase; color: #4a5866; margin: 10px 0 4px; letter-spacing: .04em; }
#toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px;
  display: none; z-index: 200; max-width: 80vw; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
#toast.on { display: flex; gap: 12px; align-items: center; }
#toast button { background: #fff; color: var(--ink); border: 0; }
@media (max-width: 900px) {
  :root { --label: 120px; }
  main { flex-direction: column; height: auto; }
  #board { height: 70vh; }
  #side { width: auto; border-left: 0; border-top: 1px solid var(--line); }
}

/* live mode: sign-in, who's signed in, save state */
.who-box { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 12px; }
.who-box a { color: var(--ink); }
.sync { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #eef2f6; color: var(--muted); }
.sync:empty { display: none; }
.sync.saving, .sync.loading { background: #fff1c2; color: #6a5300; }
.sync.saved { background: #e3f5e8; color: #1e6b35; }
.sync.error, .sync.offline { background: #ffd8d8; color: #a00; }
#banner.live { background: #e9f4ff; border-bottom-color: #c5ddf5; }
#login { position: fixed; inset: 0; z-index: 200; background: rgba(29, 39, 51, .55); display: flex; align-items: center; justify-content: center; }
#login[hidden] { display: none; }
#loginForm { background: #fff; border-radius: 10px; padding: 22px 24px; width: min(360px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.3); display: flex; flex-direction: column; gap: 10px; }
#loginForm h2 { margin: 0; font-size: 18px; }
#loginForm label { display: flex; flex-direction: column; gap: 3px; font-weight: 600; font-size: 12px; }
#loginForm input { padding: 8px; border: 1px solid #c9d1da; border-radius: 6px; font-size: 15px; }
#loginForm button { padding: 9px; font-size: 15px; background: var(--ink); color: #fff; border-color: var(--ink); }

/* ripple "ask first" */
#rippleAsk { position: fixed; inset: 0; z-index: 150; background: rgba(29, 39, 51, .45); display: flex; align-items: center; justify-content: center; }
#rippleAsk .ra { background: #fff; border-radius: 10px; padding: 16px 18px; width: min(560px, 94vw); max-height: 80vh; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
#rippleAsk .list li { cursor: default; }
#rippleAsk .list li.other { background: #fff4e5; border-left: 4px solid #e08a00; }
#rippleAsk button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
