/* Gripvan brand (website redesign): charcoal, warm off-white, rust accent, Geist. Shift colours stay as they are. */
:root {
  --bg:#f7f7f5; --card:#fff; --ink:#232528; --muted:#5c5f64; --line:#e3e3df; --accent:#b85621; --ok:#15803d; --warn:#b45309; --bad:#b91c1c;
  --bar:#232528; --bar-ink:#d2d4d6; --rust:#b85621; color-scheme:light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#1a1c1f; --card:#232528; --ink:#f4f4f2; --muted:#a9acb0; --line:#3e4146; --accent:#d9773f; --bar:#141517; color-scheme:dark; }
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
html, body { margin:0; background:var(--bg); color:var(--ink); font:15px/1.45 'Geist',ui-sans-serif,system-ui,-apple-system,'Segoe UI',sans-serif; -webkit-text-size-adjust:100%; -webkit-font-smoothing:antialiased; }
a { color:var(--accent); }
button, select, input, textarea { font:inherit; color:var(--ink); background:var(--card); border:1px solid var(--line); border-radius:8px; }
button { padding:7px 12px; cursor:pointer; }
button.primary { background:var(--accent); border-color:var(--accent); color:#fff; font-weight:600; }
button.danger { color:var(--bad); }
button.small { padding:3px 9px; font-size:13px; }
button:disabled { opacity:.5; cursor:default; }
input, select, textarea { padding:7px 9px; max-width:100%; }
label { font-size:13px; color:var(--muted); }
label > input:not([type=checkbox]), label > select, label > textarea { display:block; width:100%; margin-top:3px; color:var(--ink); }
.muted { color:var(--muted); }
.row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.grow { flex:1; }

/* top bar + nav */
.top { position:sticky; top:0; z-index:10; background:var(--bar); color:var(--bar-ink); display:flex; align-items:center; gap:4px; padding:0 12px; height:50px; }
.top .brand { display:inline-flex; align-items:center; gap:8px; font-weight:600; letter-spacing:-.01em; color:#f4f4f2; margin-right:10px; white-space:nowrap; }
.top .brand svg { color:var(--rust); flex:none; }
.top nav { display:flex; gap:2px; overflow-x:auto; scrollbar-width:none; flex:1; }
.top nav a { color:#aeb5c2; text-decoration:none; padding:0 10px; height:50px; display:flex; align-items:center; gap:6px; white-space:nowrap; border-bottom:2px solid transparent; font-size:14px; }
.top nav a.on { color:#fff; border-bottom-color:var(--accent); font-weight:600; }
.top .me { display:flex; gap:8px; align-items:center; white-space:nowrap; }
.top .me button { background:transparent; color:var(--bar-ink); border-color:#4a4d52; padding:4px 10px; font-size:13px; }
.count { font-size:11px; font-weight:700; min-width:18px; height:18px; padding:0 5px; border-radius:9px; display:inline-flex; align-items:center; justify-content:center; background:var(--bad); color:#fff; }
.bottom { display:none; }
@media (max-width: 760px) {
  .top nav { display:none; }
  .bottom { display:flex; position:fixed; bottom:0; left:0; right:0; z-index:10; background:var(--bar); padding-bottom:env(safe-area-inset-bottom); }
  .bottom a { flex:1; color:#aeb5c2; text-decoration:none; text-align:center; font-size:11px; padding:7px 2px 6px; position:relative; }
  .bottom a .i { display:block; font-size:19px; line-height:1.1; }
  .bottom a.on { color:#fff; }
  .bottom a .count { position:absolute; top:3px; left:55%; }
  main { padding-bottom:84px !important; }
}

main { max-width:1200px; margin:0 auto; padding:14px 14px 40px; }
h1 { font-size:20px; margin:4px 0 12px; }
h2 { font-size:12px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin:18px 0 8px; }
.card { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:12px 14px; margin-bottom:10px; }
.empty { color:var(--muted); padding:8px 0; }

/* shift chips */
.chip { display:inline-block; font-size:12.5px; font-weight:600; padding:2px 8px; border-radius:6px; color:#fff; background:var(--c, #64748b); white-space:nowrap; }
.chip.off { background:transparent; color:var(--muted); border:1px dashed var(--line); font-weight:400; }
.chip.leave { background:#e5e7eb; color:#374151; }
/* leave kinds: holiday green, sick red, training gold, anything else grey */
.lv-holiday { --lv:#16a34a; --lvbg:#dcfce7; --lvfg:#14532d; }
.lv-sick { --lv:#dc2626; --lvbg:#fee2e2; --lvfg:#7f1d1d; }
.lv-training { --lv:#ca8a04; --lvbg:#fef9c3; --lvfg:#713f12; }
.lv-other, .lv-away { --lv:#6b7280; --lvbg:#e5e7eb; --lvfg:#374151; }
.chip.leave[class*="lv-"] { background:var(--lvbg); color:var(--lvfg); border:1px solid var(--lv); }
td.cell.lvcell { background:color-mix(in srgb, var(--lv) 14%, transparent); }
.training-note { border-color:#ca8a04; color:inherit; padding:8px 12px; font-size:13.5px; }
.lvkey .chip { font-size:11px; padding:1px 6px; }
.lvkey-row { margin-top:6px; text-align:right; }
.chip.onset { background:#ccfbf1; color:#134e4a; }
.tag { font-size:11px; padding:1px 6px; border-radius:4px; background:var(--bg); border:1px solid var(--line); color:var(--muted); }
@media (prefers-color-scheme: dark) {
  .lv-holiday { --lvbg:#14532d; --lvfg:#dcfce7; } .lv-sick { --lvbg:#7f1d1d; --lvfg:#fee2e2; } .lv-training { --lvbg:#713f12; --lvfg:#fef9c3; } .lv-other, .lv-away { --lvbg:#374151; --lvfg:#e5e7eb; }
  .chip.leave { background:#374151; color:#e5e7eb; } .chip.onset { background:#134e4a; color:#ccfbf1; } }

/* my shifts */
.day { display:flex; gap:12px; align-items:center; padding:9px 0; border-top:1px solid var(--line); }
.day:first-child { border-top:0; }
.day .d { width:92px; flex:0 0 auto; }
.day .d b { display:block; }
.day.today .d b { color:var(--accent); }
.day .what { flex:1; display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.day.offday { opacity:.75; }

/* rota grid */
.grid-wrap { overflow:auto; background:var(--card); border:1px solid var(--line); border-radius:12px; }
table.grid { border-collapse:separate; border-spacing:0; width:100%; min-width:760px; font-size:13px; }
table.grid th, table.grid td { border-bottom:1px solid var(--line); padding:5px 6px; text-align:center; }
table.grid th { position:sticky; top:0; background:var(--card); z-index:2; font-weight:600; }
table.grid th.today { color:var(--accent); }
table.grid td.who, table.grid th.who { text-align:left; position:sticky; left:0; background:var(--card); z-index:1; min-width:150px; border-right:1px solid var(--line); }
table.grid td.who small { color:var(--muted); display:block; font-size:11px; }
table.grid td.cell { cursor:default; min-width:84px; }
table.grid.edit td.cell { cursor:pointer; }
table.grid.edit td.cell:hover { background:color-mix(in srgb, var(--accent) 8%, transparent); }
table.grid td.cell .t { display:block; font-size:10.5px; color:var(--muted); margin-top:2px; }
table.grid tr.team td { background:var(--bg); text-align:left; font-weight:700; font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); position:static; }
table.grid tr.cov td { font-size:12px; }
.under { color:var(--bad); font-weight:700; }
/* a shift changed from someone's pattern: a small star in the corner (hover for what changed) */
.changed { position:relative; }
td.cell.changed::after, .who-chip.changed::after { content:'★'; position:absolute; top:2px; right:3px; font-size:9px; line-height:1; color:var(--warn); }
.who-chip.changed { padding-right:14px; }
.star { color:var(--warn); }
.pending-bar { display:flex; gap:10px; align-items:center; padding:8px 12px; font-size:13.5px; }
.weekly { display:flex; gap:6px; align-items:center; font-size:13.5px; color:var(--muted); }

/* lists */
.item { display:flex; gap:10px; align-items:flex-start; padding:10px 0; border-top:1px solid var(--line); flex-wrap:wrap; }
.item:first-child { border-top:0; }
.item .main { flex:1; min-width:200px; }
.status { font-size:12px; font-weight:600; padding:2px 8px; border-radius:99px; background:var(--bg); border:1px solid var(--line); }
.status.pending, .status.proposed, .status.accepted { color:var(--warn); }
.status.approved, .status.filled { color:var(--ok); }
.status.declined, .status.rejected, .status.cancelled, .status.withdrawn { color:var(--muted); }

dialog { border:1px solid var(--line); border-radius:14px; background:var(--card); color:var(--ink); padding:16px 18px; width:min(520px, calc(100vw - 24px)); max-height:90vh; }
dialog::backdrop { background:rgba(0,0,0,.45); }
dialog h3 { margin:0 0 10px; }
dialog .acts { display:flex; justify-content:flex-end; gap:8px; margin-top:14px; flex-wrap:wrap; }
.stack > * { margin-bottom:10px; }
.two { display:grid; grid-template-columns:1fr 1fr; gap:10px; }

/* login */
.login { max-width:380px; margin:8vh auto; text-align:center; }
.login .card { text-align:left; }
.or { text-align:center; color:var(--muted); margin:14px 0; font-size:13px; }

.toast { position:fixed; bottom:90px; left:50%; transform:translateX(-50%); background:#232528; color:#fff; padding:9px 14px; border-radius:9px; opacity:0; transition:opacity .2s; pointer-events:none; z-index:50; max-width:90vw; }
.toast.show { opacity:1; }

/* pattern editor */
table.pat { border-collapse:collapse; width:100%; font-size:13px; }
table.pat td, table.pat th { border:1px solid var(--line); padding:4px; text-align:center; }
table.pat select { width:100%; padding:3px; font-size:12.5px; }

/* offering shifts and availability */
.cands { display:flex; flex-direction:column; gap:2px; max-height:280px; overflow:auto; border:1px solid var(--line); border-radius:8px; padding:6px; }
.cand { display:flex; gap:8px; align-items:center; color:var(--ink); padding:4px 2px; font-size:14px; }
.cand .grow { flex:1; }
.pick { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.pick button.on { background:var(--c, var(--accent)); border-color:var(--c, var(--accent)); color:#fff; }
.pick .t { opacity:.75; font-size:11.5px; }
.pick .hours { display:inline-flex; gap:4px; }
.pick .hours[hidden] { display:none; }
.chip.free { background:#dcfce7; color:#14532d; white-space:normal; }
.card.ask { border-color:var(--warn); }
.bad { color:var(--bad); font-weight:600; }
@media (prefers-color-scheme: dark) { .chip.free { background:#14532d; color:#dcfce7; } }

/* rota: by name / by shift */
.seg { display:inline-flex; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.seg button { border:0; border-radius:0; }
.seg button.on { background:var(--accent); color:#fff; font-weight:600; }
.legend { padding:0 4px; }
table.byshift td.names { vertical-align:top; text-align:left; min-width:96px; }
table.byshift td.who small { display:block; }
table.byshift .shiftn { font-size:11px; color:var(--muted); margin-bottom:3px; white-space:nowrap; }
table.byshift .shiftn.under { color:var(--bad); font-weight:700; }
.who-chip { display:block; padding:2px 5px; margin:1px 0; border-radius:5px; background:var(--bg); white-space:nowrap; }
.who-chip small { color:var(--muted); }
table.byshift.edit .who-chip { cursor:pointer; }
table.byshift.edit .who-chip:hover { background:color-mix(in srgb, var(--accent) 15%, transparent); }

/* away all day: shift struck through */
.chip.struck { text-decoration:line-through; text-decoration-thickness:2px; opacity:.45; }
.t.struck { text-decoration:line-through; opacity:.6; }
/* foldable rota sections */
table.grid tr.fold td { cursor:pointer; user-select:none; }
table.grid tr.fold .caret { display:inline-block; transition:transform .15s; }
table.grid tr.fold.shut .caret { transform:rotate(-90deg); }
table.grid tr.fold .n { font-weight:400; opacity:.8; }
.cand[hidden] { display:none; }
.selall { display:flex; gap:6px; justify-content:flex-end; }

/* My shifts: a compact calendar – one row per week, a tile per day */
.card.next { padding:10px 12px; font-size:14.5px; }
.card.cal { padding:8px; }
.calrow { display:grid; grid-template-columns:42px repeat(7, minmax(0, 1fr)); gap:4px; align-items:stretch; margin-bottom:4px; }
.calrow.head span { font-size:11px; font-weight:700; color:var(--muted); text-align:center; }
.calrow .wk { font-size:11px; color:var(--muted); align-self:center; line-height:1.1; }
.tile { position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1px; min-height:54px; padding:4px 2px;
  border:1px solid var(--line); border-radius:8px; background:color-mix(in srgb, var(--c) 16%, var(--card)); border-top:3px solid var(--c); cursor:pointer; overflow:hidden; }
.tile .dn { font-size:11px; color:var(--muted); line-height:1; }
.tile .sh { font-size:12.5px; font-weight:700; line-height:1.15; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }
.tile .tm { font-size:10.5px; color:var(--muted); white-space:nowrap; }
.tile.off { background:transparent; border-top-color:var(--line); cursor:default; }
.tile.off .sh { color:var(--muted); font-weight:400; }
.tile:disabled { opacity:.35; }
.tile.gone .sh { text-decoration:line-through; opacity:.5; }
.tile.gone .tm { max-width:100%; overflow:hidden; text-overflow:ellipsis; }
.tile.today { outline:2px solid var(--accent); outline-offset:1px; }
.tile.changed::after { content:'★'; position:absolute; top:2px; right:3px; font-size:9px; color:var(--warn); }
@media (max-width:420px) { .calrow { grid-template-columns:30px repeat(7, minmax(0, 1fr)); gap:3px; } .tile .sh { font-size:11.5px; } .tile .tm { font-size:9.5px; } }
.card.cal, .card.next { max-width:760px; }

/* My shifts: leave tiles take the leave colour */
.tile.gone { background:color-mix(in srgb, var(--lv) 22%, var(--card)); border-top-color:var(--lv); border-color:var(--lv); }
.tile.gone .sh { text-decoration:none; opacity:1; color:var(--lv); }
.tile.gone .tm s { opacity:.7; }
.tile.part { box-shadow:inset 0 -3px 0 var(--lv); }
.chip.leave { max-width:160px; overflow:hidden; text-overflow:ellipsis; vertical-align:middle; }

/* working from home */
.chip.wfh { background:#e0f2fe; color:#075985; border:1px solid #0284c7; font-size:11px; padding:1px 6px; }
.chip.wfh.unbooked { border-style:dashed; background:transparent; }
.wfh-t { color:#0284c7; font-weight:700; }
@media (prefers-color-scheme: dark) { .chip.wfh { background:#0c4a6e; color:#e0f2fe; } .chip.wfh.unbooked { background:transparent; color:#7dd3fc; } }

/* rota boxes: shift, times, then tags – stacked the same way in every column */
td.cell .cellstack { display:flex; flex-direction:column; align-items:center; gap:2px; }
td.cell .cellstack .t { margin-top:0; }
td.cell .cellstack .tags { display:flex; flex-wrap:wrap; gap:3px; justify-content:center; }

/* 🎂 on someone's birthday: top-left corner of their box or tile */
.tile.bday { position:relative; }
.tile.bday::before { content:'🎂'; position:absolute; top:2px; left:3px; font-size:13px; line-height:1; }
td.cell .line1 { display:inline-flex; align-items:center; gap:4px; }
td.cell .cake { font-size:15px; line-height:1; }

/* rota header: wraps on phones */
.rotahead { flex-wrap:wrap; gap:6px; }
.rotahead input[type="date"] { padding:5px 8px; }
table.grid th.we { color:var(--muted); }
/* month view: one narrow column per day, short labels */
table.grid.month { min-width:0; font-size:12px; }
table.grid.month th { padding:4px 2px; font-size:11px; line-height:1.15; }
table.grid.month td.cell.m { min-width:30px; padding:3px 1px; position:relative; }
.mchip { display:inline-block; min-width:22px; padding:2px 3px; border-radius:5px; font-size:11px; font-weight:700; color:#fff; background:var(--c); }
.mchip.off { color:var(--muted); font-weight:400; }
.mchip.lv { color:var(--lv); background:transparent; }
td.cell.m .cake { position:absolute; top:0; left:1px; font-size:10px; }
td.cell.m .mwfh { position:absolute; bottom:0; right:2px; font-size:10px; color:#0284c7; }
td.cell.m.changed::after { top:0; right:1px; }
table.grid.month.byshift td.names { min-width:64px; font-size:11px; }
table.grid.month.byshift .who-chip { padding:1px 3px; }
table.grid.month.byshift { width:max-content; } table.grid.month.byshift td.names, table.grid.month.byshift th:not(.who) { width:70px; min-width:70px; max-width:70px; } table.grid.month.byshift .who-chip { overflow:hidden; text-overflow:ellipsis; }
.small-note { font-size:13px; max-width:760px; margin:8px 0 0; }
.bonus { gap:6px; margin-top:4px; font-size:13px; align-items:center; }
table.grid td.who a.phone { display:block; font-size:11px; color:var(--muted); text-decoration:none; } table.grid td.who a.phone:hover { color:var(--accent); }
details.psec > summary { list-style:none; cursor:pointer; user-select:none; }
details.psec > summary::-webkit-details-marker { display:none; }
details.psec > summary h2 { display:inline-flex; align-items:center; gap:6px; }
details.psec > summary h2::before { content:'▾'; display:inline-block; transition:transform .15s; }
details.psec:not([open]) > summary h2::before { transform:rotate(-90deg); }
.prefs { display:flex; flex-direction:column; gap:4px; max-width:760px; margin-top:10px; }
.prefs .weekly { color:var(--ink); min-height:32px; }
td.who.card-link { cursor:pointer; }
td.who.card-link:hover { text-decoration:underline; text-underline-offset:3px; }
.contact { display:flex; flex-wrap:wrap; gap:8px; }
.contact .btn { min-height:44px; font-weight:500; text-decoration:none; color:var(--ink); border:1px solid var(--line); }
.cardshift { flex:2; display:flex; flex-wrap:wrap; gap:4px; align-items:center; }
.rotahead h1 { flex:1 1 320px; }

/* contact card */
.pcard { display:flex; flex-direction:column; gap:14px; min-width:min(420px, 80vw); }
.phead h3 { margin:0 0 2px; font-size:20px; letter-spacing:-.01em; }
.phead .muted { font-size:13.5px; }
.pcontact { display:flex; flex-wrap:wrap; gap:8px; }
.pcontact a { display:inline-flex; align-items:center; gap:8px; min-height:40px; padding:0 14px; border:1px solid var(--line); border-radius:999px;
  color:var(--ink); text-decoration:none; font-size:14px; background:var(--bg); max-width:100%; }
.pcontact a span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pcontact a svg { color:var(--accent); flex:none; }
.pcontact a:hover { border-color:var(--accent); }
.pdays { display:flex; flex-direction:column; border:1px solid var(--line); border-radius:12px; overflow:hidden; }
.pday { display:flex; align-items:center; gap:12px; padding:11px 14px; border:0; border-radius:0; background:transparent; text-align:left; width:100%; font:inherit; color:var(--ink); }
.pday + .pday { border-top:1px solid var(--line); }
button.pday { cursor:pointer; }
button.pday:hover { background:color-mix(in srgb, var(--accent) 7%, transparent); }
.pday.today .pd { color:var(--accent); }
.pday .pd { width:84px; flex:none; font-weight:600; font-size:14px; }
.pday .ps { flex:1; display:flex; flex-wrap:wrap; align-items:center; gap:6px; font-size:14px; min-width:0; }
.pday .chev { color:var(--muted); font-size:18px; line-height:1; }
.pday .dot { width:9px; height:9px; border-radius:50%; background:var(--c); flex:none; }
.pday .chip.leave { font-size:12px; padding:2px 8px; }
.phint { margin:-4px 0 0; font-size:12.5px; }
.btn-mini { display:inline-block; font-size:12px; font-weight:600; padding:3px 9px; border-radius:999px; text-decoration:none; border:1px solid var(--warn); color:var(--warn); }
.coveracts { display:flex; gap:6px; align-items:center; flex-wrap:wrap; justify-content:flex-end; } .small-link { font-size:13px; color:var(--muted); }
