/* App shell (Magic Patterns design, 17 Nov 2026): sidebar on desktop, bottom tab bar on phones. */
:root { --paper:#f7f6f3; --side:236px; --pill-grey:#f1f0ee; }
body.shell { background:var(--paper); padding-left:var(--side); }
.side { position:fixed; inset:0 auto 0 0; width:var(--side); background:#fff; border-right:1px solid var(--line); display:flex; flex-direction:column; z-index:20; }
.side .brand { padding:16px 16px 12px; gap:10px; font-size:15px; color:var(--ink); }
.side .brand span { display:flex; flex-direction:column; line-height:1.2; }
.side .brand small { font-weight:400; font-size:12px; color:var(--muted); }
.sidenav { flex:1; display:flex; flex-direction:column; gap:2px; padding:4px 8px; overflow-y:auto; }
.sidenav a, .tabbar a { display:flex; align-items:center; gap:10px; padding:8px 12px; border-radius:8px; color:#3b4250; text-decoration:none; font-size:14px; }
.sidenav a:hover { background:#f2f2f0; }
.sidenav a.on { background:rgba(31,58,95,.09); color:var(--brand); font-weight:600; }
.sidenav .ni { width:18px; text-align:center; }
.sidenav .nl { flex:1; }
.sidenav .nx { font-size:10px; color:#a0a6af; }
.navsep { margin:10px 12px 2px; font-size:11px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:#a0a6af; min-height:1px; }
.sidestat { margin:8px 12px; padding:10px 12px; border:1px solid var(--line); border-radius:10px; background:#fafaf9; text-decoration:none; color:var(--ink); display:grid; grid-template-columns:auto 1fr; gap:2px 8px; font-size:12px; }
.sidestat .dot { width:8px; height:8px; border-radius:50%; background:#18a058; align-self:center; }
.sidestat .sst { font-weight:600; }
.sidestat .ssd { grid-column:1/-1; color:var(--muted); }
.sidestat .bar { grid-column:1/-1; height:6px; background:#e7e5e1; border-radius:6px; overflow:hidden; margin-top:4px; }
.sidestat .bar i { display:block; height:100%; background:var(--brand); }
.me { display:flex; align-items:center; gap:8px; padding:12px 14px; border-top:1px solid var(--line); font-size:13px; }
.me .av { width:30px; height:30px; border-radius:50%; background:#e7e5e1; display:grid; place-items:center; font-weight:600; }
.me .mel { flex:1; display:flex; flex-direction:column; line-height:1.2; min-width:0; }
.me .mel b { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.me small { color:var(--muted); font-size:11px; }
.me button.link { font-size:12px; }
.tabbar { display:none; }
body.shell > main { max-width:1320px; }
body.noshell { padding:0; }
.top { display:none; }

/* shared bits for the new screens */
.pagehead { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin:2px 0 16px; }
.pagehead h1 { margin:0; flex:1; min-width:0; }
.pill { display:inline-flex; align-items:center; gap:4px; border-radius:999px; padding:1px 8px; font-size:11.5px; font-weight:500; border:1px solid transparent; white-space:nowrap; }
.pill.green { background:#ecfdf3; color:#05603a; border-color:#abefc6; }
.pill.amber { background:#fffaeb; color:#93370d; border-color:#fedf89; }
.pill.red { background:#fef3f2; color:#b42318; border-color:#fecdca; }
.pill.blue { background:#eff8ff; color:#175cd3; border-color:#b2ddff; }
.pill.grey { background:var(--pill-grey); color:#454b55; border-color:#e3e1dd; }
.pill.navy { background:var(--brand); color:#fff; }
.chips { display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.chip { border:1px solid #cfd5dc; background:#fff; border-radius:999px; padding:5px 12px; font-size:12.5px; font-weight:500; text-decoration:none; color:var(--ink); white-space:nowrap; cursor:pointer; }
.chip.on { background:var(--brand); border-color:var(--brand); color:#fff; }
.chip.dash { border-style:dashed; color:#555; }
.pbar { height:6px; background:#e7e5e1; border-radius:6px; overflow:hidden; }
.pbar i { display:block; height:100%; background:var(--brand); }
.pbar.green i { background:#18794e; } .pbar.amber i { background:#e0a100; }
.stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:16px; }
.stat { background:#fff; border:1px solid var(--line); border-radius:12px; padding:14px 16px; }
.stat small { color:var(--muted); font-size:12px; display:block; }
.stat b { font-size:24px; display:block; margin:2px 0; }
.grid2 { display:grid; grid-template-columns:minmax(0,2fr) minmax(0,1fr); gap:16px; }
.card h2 .pill { margin-left:8px; vertical-align:middle; }

@media (max-width: 860px) {
  body.shell { padding-left:0; padding-bottom:64px; }
  .side { display:none; }
  .tabbar { display:grid; grid-template-columns:repeat(5,1fr); position:fixed; inset:auto 0 0 0; background:#fff; border-top:1px solid var(--line); z-index:30; padding-bottom:env(safe-area-inset-bottom); }
  .tabbar a { flex-direction:column; gap:1px; padding:7px 2px 6px; font-size:11px; border-radius:0; color:#6b7380; }
  .tabbar a .ni { font-size:19px; line-height:1; }
  .tabbar a.on { color:var(--brand); font-weight:600; }
  body.shell > main { padding:14px 12px 30px; }
  .stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .grid2 { grid-template-columns:1fr; }
}

/* Older screens on phones: never scroll the whole page sideways. */
@media (max-width: 860px) {
  body.shell > main { overflow-x: clip; }
  body.shell main .card { max-width: 100%; overflow-x: auto; }
  body.shell main table.t { display: block; overflow-x: auto; max-width: 100%; }
  body.shell main label { white-space: normal; max-width: 100%; }
  .bandfilter { flex-wrap: wrap; }
  .boardrow, .bandrow { flex-direction: column; }
}

/* Projects (18 Nov 2026): project switcher under the brand, and the /projects page. */
.side .brand { padding-bottom:6px; }
.projsw { position:relative; margin:0 10px 6px; }
.projsw > summary { list-style:none; cursor:pointer; display:grid; grid-template-columns:1fr auto; gap:0 6px; padding:7px 10px; border:1px solid var(--line); border-radius:9px; background:#fafaf9; }
.projsw > summary::-webkit-details-marker { display:none; }
.projsw > summary:hover { border-color:#c3c9d1; }
.projsw .psl { grid-column:1; font-size:10.5px; text-transform:uppercase; letter-spacing:.04em; color:#a0a6af; font-weight:600; }
.projsw .psn { grid-column:1; font-size:13.5px; font-weight:600; color:var(--ink); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.projsw .psc { grid-column:2; grid-row:1 / span 2; align-self:center; color:#6b7380; font-size:12px; }
.projsw[open] .psc { transform:rotate(180deg); }
.projmenu { position:absolute; left:0; right:0; top:calc(100% + 4px); background:#fff; border:1px solid var(--line); border-radius:10px; box-shadow:0 8px 24px rgba(16,24,40,.14); padding:5px; z-index:40; max-height:60vh; overflow-y:auto; }
.projmenu form { margin:0; }
.projmenu button, .projmenu a { display:flex; align-items:center; gap:6px; width:100%; text-align:left; border:0; background:none; border-radius:7px; padding:7px 8px; font-size:13.5px; color:var(--ink); text-decoration:none; cursor:pointer; }
.projmenu button:hover, .projmenu a:hover { background:#f2f2f0; }
.projmenu button.on { font-weight:600; color:var(--brand); }
.projmenu .pk { width:14px; color:var(--brand); }
.projmenu .pn { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.projmenu hr { border:0; border-top:1px solid var(--line); margin:4px 2px; }
.projmenu a { color:#3b4250; padding-left:28px; }
.projgrid { display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:16px; margin-bottom:16px; }
.projgrid .card { margin:0; display:flex; flex-direction:column; gap:10px; }
.projcard.current { border-color:var(--brand); box-shadow:0 0 0 1px var(--brand) inset; }
.projtop { display:flex; align-items:center; gap:8px; }
.projtop h2 { margin:0; flex:1; font-size:18px; }
.projmeta { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.projdesc { margin:0; color:#3b4250; font-size:14px; }
.projnums { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin:0; }
.projnums div { background:#fafaf9; border:1px solid var(--line); border-radius:9px; padding:8px 10px; }
.projnums dt { font-size:11.5px; color:var(--muted); }
.projnums dd { margin:2px 0 0; font-weight:600; font-size:15px; }
.projacts { display:flex; align-items:center; gap:10px; margin-top:auto; }
.projacts form { margin:0; }
.projacts button.primary { min-height:38px; padding:0 22px; }
.newproj > summary { list-style:none; cursor:pointer; }
.newproj > summary::-webkit-details-marker { display:none; }
.newproj > summary h2 { display:inline; margin:0; font-size:17px; color:var(--brand); }
.projform { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-top:12px; }
.projform label { display:flex; flex-direction:column; gap:4px; font-size:13px; font-weight:500; }
.projform .wide { grid-column:1 / -1; }
.projform input, .projform select, .projform textarea { font:inherit; font-weight:400; padding:8px 10px; border:1px solid #cfd5dc; border-radius:8px; background:#fff; }
.projform .wide button { margin-right:10px; min-height:40px; }
@media (max-width: 860px) {
  .projgrid { grid-template-columns:1fr; }
  .projnums { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .projform { grid-template-columns:1fr; }
}
.projnums { grid-template-columns:repeat(auto-fit,minmax(118px,1fr)); }
