/* Home + the smallest legacy-markup adapter for Shell Reference 004.
 * No global token/control rewrite: Login, public calendar and other view contents
 * keep their existing rules. Geometry/tokens follow 004; no demonstrator JS/data.
 */
#shell-menu,#shell-scrim { display:none; }
body.cis-ui-shell:not(:has(#main > .login-page)) { background:#101214; padding-bottom:0; }
body.cis-ui-shell:not(:has(#main > .login-page)) > header {
  height:60px; padding:0 18px; gap:12px; background:#101215;
  border-bottom:1px solid #292c30; box-shadow:none; backdrop-filter:none; z-index:50;
}
.cis-ui-shell:not(:has(.login-page)) > header .brand { flex:0 0 auto; min-height:36px; }
.cis-ui-shell:not(:has(.login-page)) > header .brand-lockup { width:118px; height:26px; max-height:26px; }
.cis-ui-shell:not(:has(.login-page)) .header-cis-control { display:block; flex:0 1 220px; width:220px; margin-left:0; min-width:0; }
.cis-ui-shell:not(:has(.login-page)) .header-cis-control:has([hidden]) { display:none; }
.cis-ui-shell:not(:has(.login-page)) :is(#cis-select,#cis-name) {
  max-width:220px; min-width:0; height:38px; min-height:38px; padding:7px 12px;
  border:1px solid #292c30; border-radius:999px; background:#191b1e; font-size:13px;
  line-height:22px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.cis-ui-shell:not(:has(.login-page)) #cis-select { width:100%; padding-right:28px; }
.cis-ui-shell:not(:has(.login-page)) #cis-name { flex:0 1 220px; }
.cis-ui-shell:not(:has(.login-page)) #identity { margin-left:auto; max-width:230px; font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cis-ui-shell:not(:has(.login-page)) #auth-button { margin-left:auto; min-height:38px; padding:7px 12px; }
.cis-ui-shell:not(:has(.login-page)) #identity + #auth-button { margin-left:0; }
.cis-ui-shell:not(:has(.login-page)) > .shell { display:grid; grid-template-columns:196px minmax(0,1fr); min-height:calc(100vh - 60px); }
.cis-ui-shell:not(:has(.login-page)) > .shell > aside {
  position:sticky; top:60px; width:196px; height:calc(100dvh - 60px); min-height:0;
  display:flex; flex-direction:column; align-items:stretch; flex-wrap:nowrap; gap:10px;
  padding:14px 10px; border-right:1px solid #292c30; border-bottom:0;
  overflow:hidden; background:#191b1e; box-shadow:none; backdrop-filter:none; z-index:30;
}
.cis-ui-shell:not(:has(.login-page)) .shell > aside #nav {
  position:static; width:100%; height:auto; max-width:none; min-height:0; flex:1 1 auto;
  display:flex; flex-direction:column; align-items:stretch; gap:5px; padding:2px 2px 12px;
  margin:0; overflow-x:hidden; overflow-y:auto; border:0; background:transparent; box-shadow:none; backdrop-filter:none;
}
.cis-ui-shell:not(:has(.login-page)) #nav :is(button,.button-link) {
  position:relative; display:flex; flex-direction:row; flex:0 0 auto; align-items:center; justify-content:flex-start;
  width:100%; min-height:36px; padding:7px 9px; gap:8px;
  border:1px solid transparent; border-radius:7px; background:transparent; box-shadow:none;
  font-size:12px; font-weight:600; line-height:1.25; color:#bfc2c6; text-align:left; white-space:normal;
}
.cis-ui-shell:not(:has(.login-page)) #nav :is(button,.button-link):hover { background:#292c30; color:#fff; }
.cis-ui-shell:not(:has(.login-page)) #nav [aria-current=page] {
  padding-left:6px; border-color:rgba(75,148,244,.56); border-left:4px solid #1568d4;
  background:rgba(21,104,212,.19); color:#fff;
}
.cis-ui-shell:not(:has(.login-page)) #nav .ui-icon { width:18px; height:18px; flex-basis:18px; }
.cis-ui-shell:not(:has(.login-page)) #nav .nav-feedback { order:0; margin:0; }
.cis-ui-shell:not(:has(.login-page)) #nav .nav-feedback::before { content:none; }
.cis-ui-shell:not(:has(.login-page)) .cis-nav-utilities { margin-top:auto; padding-top:10px; border-top:1px solid #292c30; display:grid; gap:4px; }
.cis-ui-shell:not(:has(.login-page)) .shell > aside .aside-note { display:none; }
.cis-ui-shell:not(:has(.login-page)) .shell > aside #install-app { width:100%; margin:0; }
.cis-ui-shell:not(:has(.login-page)) > .shell > #main { padding:24px clamp(22px,2.5vw,38px); }
.cis-ui-shell:not(:has(.login-page)) #patch-version { position:static; margin-left:196px; max-width:none; }
.cis-ui-shell:not(:has(.login-page)) #nav .unread-badge { position:static; margin-left:auto; }
.cis-ui-shell:not(:has(.login-page)) :is(button,select,input,textarea,a,summary):focus-visible { outline:3px solid #6bb7ff; outline-offset:3px; }

/* Home content: existing server board + today's actual two shifts, not an activity feed. */
.home-page { min-width:0; }
.home-page .daily-hero { margin:0 0 20px; }
.home-page .daily-hero h1 { font-size:30px; line-height:1.15; letter-spacing:-.035em; margin:5px 0 7px; }
.home-page .daily-hero p { margin:0; color:#a8abb0; font-size:13px; line-height:1.5; }
.home-page .daily-hero .home-date { font-size:12px; }
.home-layout { display:grid; grid-template-columns:minmax(0,1.45fr) minmax(320px,1fr); gap:18px; align-items:start; }
.home-layout-single { grid-template-columns:1fr; }
.home-layout-single .home-daily:empty { display:none; }
.home-notices,.home-page .daily-section { min-width:0; border:1px solid #35383d; border-radius:8px; background:#191b1e; overflow:hidden; }
.home-page .section-head { display:flex; align-items:flex-start; flex-wrap:wrap; gap:12px; margin:0; padding:14px; border-bottom:1px solid #292c30; }
.home-page h2 { font-size:19px; line-height:1.3; }
.home-page .section-head p { margin:4px 0 0; color:#a8abb0; font-size:12px; }
.home-page .actions { display:flex; flex-wrap:wrap; gap:8px; }
.home-count { display:inline-grid; place-items:center; min-width:23px; min-height:23px; padding:1px 6px; margin-left:8px; border:1px solid #35383d; border-radius:999px; color:#a8abb0; background:#222529; font-size:12px; vertical-align:middle; }
.home-page button { min-height:36px; padding:7px 10px; font-size:12px; box-shadow:none; }
.home-page button.primary,body:has(.home-page) dialog button.primary { background:#1568d4; border-color:#4b9cff; color:#fff; box-shadow:none; }
.home-page button.primary:hover,body:has(.home-page) dialog button.primary:hover { background:#0f58b8; }
.home-page .home-board { display:grid; gap:0; }
.home-page .home-notice { border:0; border-bottom:1px solid #292c30; border-radius:0; background:transparent; }
.home-page .home-notice:last-child { border-bottom:0; }
.home-page .home-notice.home-important { border-left:3px solid #f2c94c; background:#f2c94c08; }
.home-page .home-notice > summary { min-height:64px; padding:12px 14px; gap:9px; font-size:13px; }
.home-page .home-title small { font-size:11px; margin-top:4px; }
.home-page .badge { font-size:10px; padding:2px 7px; border-radius:999px; white-space:nowrap; }
.home-page .home-priority,.home-page .badge.daily-important { color:#f2cf69; border-color:#746026; background:#352e1b; }
.home-page .home-doing { color:#b3d6ff; border-color:#345e8b; background:#172b40; }
.home-page .home-detail { padding:0 14px 14px; font-size:13px; border-color:#292c30; }
.home-page .home-detail .actions { margin-top:12px; }
.home-page .home-detail .compact { font-size:12px; }
.home-page .empty { border:0; border-radius:0; background:transparent; padding:30px 16px; font-size:13px; }
.home-page .daily-section { margin:0; }
.home-page .daily-shifts { display:grid; grid-template-columns:1fr; gap:0; }
.home-page .daily-shift { border:0; border-radius:0; background:transparent; }
.home-page .daily-shift > h3 { margin:0; padding:12px 14px 8px; font-size:14px; border:0; }
.home-page .daily-shift > h3 small { color:#a8abb0; font-size:11px; font-weight:400; }
.home-page .daily-shift + .daily-shift { border-top:1px solid #292c30; }
.home-page .daily-shift > p { margin:0; padding:10px 14px 18px; font-size:12px; }
.home-page .daily-task { padding:4px 8px 4px 14px; border-color:#292c30; }
.home-page .daily-task.daily-important { color:inherit; background:#f2c94c08; border-left:3px solid #f2c94c; }
.home-page .daily-task-row { align-items:flex-start; gap:8px; }
.home-page .daily-task-row summary { min-height:36px; padding:8px 0; font-size:13px; line-height:1.5; }
.home-page .daily-task-row summary:focus-visible { outline-offset:-3px; }
.home-page .daily-task details > :not(summary) { font-size:12px; }
.home-page .daily-task details > button { margin:10px 0; }
.home-page .daily-comment { background:#17191b; }
.home-page .home-daily-tools { padding:12px 14px; border-top:1px solid #292c30; }
.home-page .home-daily-tools button { text-align:left; }
.home-load-error { padding:16px; border:1px solid #86384b; border-radius:8px; color:#ffd1da; overflow-wrap:anywhere; }
body:has(.home-page) .home-undo { background:#222529; z-index:10; font-size:13px; }
body:has(.home-page) #toast { border-radius:8px; overflow-wrap:anywhere; }
body:has(.home-page) dialog .cancel,body:has(.home-page) dialog button.danger:not([type=submit]) { background:#222529; color:#dce0e4; border-color:#596571; box-shadow:none; }
body:has(.home-page) dialog :is(input:not([type=checkbox]),select,textarea) { min-width:0; max-width:100%; }
body:has(.home-page) dialog .actions { display:flex; flex-wrap:wrap; gap:8px; }
body:has(.home-page) #dialog { padding:0; overflow:hidden; border-radius:8px; }
body:has(.home-page) #dialog-form { display:flex; flex-direction:column; max-height:calc(90dvh - 2px); }
body:has(.home-page) #dialog .dialog-heading { position:static; flex-shrink:0; margin:0; padding:16px 20px; }
body:has(.home-page) #dialog-body { overflow-y:auto; min-height:0; padding:0 20px; }
body:has(.home-page) #dialog-error { margin:0; padding:8px 20px; overflow-wrap:anywhere; }
body:has(.home-page) #dialog-error:empty { display:none; }
body:has(.home-page) #dialog .dialog-actions { position:static; flex-shrink:0; margin:0; padding:14px 20px; border-top:1px solid #35383d; }

/* Native semantics + Human Check C; scoped class, also used by Home dialogs. */
label.home-check, .daily-add label.home-check {
  position:relative; display:flex; align-items:center; gap:10px; min-width:36px; min-height:36px;
  margin:0; padding:6px; text-transform:none; letter-spacing:normal; color:inherit;
  font-size:13px; line-height:1.45; cursor:pointer; flex:none;
}
.home-check > input[type=checkbox], .daily-task-row .home-check > input[type=checkbox], .daily-add .home-check > input[type=checkbox] {
  position:absolute; inset:0; width:100%; height:100%; min-height:0; max-width:none; margin:0; padding:0; opacity:0; cursor:pointer;
}
.home-check-mark { display:block; flex:0 0 24px; width:24px; height:24px; color:#8f99a4; }
.home-check-mark svg { display:block; width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
.home-check-mark path { opacity:0; }
.home-check > input:checked + .home-check-mark { color:#4b9cff; }
.home-check > input:checked + .home-check-mark path { opacity:1; }
.home-check > input:focus-visible + .home-check-mark { outline:3px solid #6bb7ff; outline-offset:3px; border-radius:6px; }
.home-check:has(input:disabled) { opacity:.55; cursor:not-allowed; }
.home-check > input:disabled { cursor:not-allowed; }

@media (max-width:1180px) { .home-layout { grid-template-columns:1fr; } .home-page .daily-shifts { grid-template-columns:1fr 1fr; } .home-page .daily-shift + .daily-shift { border-top:0; border-left:1px solid #292c30; } }
@media (max-width:1050px) {
  .cis-ui-shell:not(:has(.login-page)) #identity { display:none; }
  .cis-ui-shell:not(:has(.login-page)) #identity + #auth-button { margin-left:auto; }
  .cis-ui-shell:not(:has(.login-page)) #nav :is(button,.button-link) { min-height:44px; }
  .cis-ui-shell:not(:has(.login-page)) > header :is(.brand,#cis-select,#cis-name,#auth-button) { min-height:44px; }
  .home-page :is(button,summary),body:has(.home-page) dialog :is(button,input:not([type=checkbox]),select) { min-height:44px; }
  label.home-check,.daily-add label.home-check { min-height:44px; min-width:44px; padding:10px; }
  .home-page .daily-task-row summary { min-height:44px; padding-block:12px; }
  .home-page .home-notice > summary { min-height:64px; }
  body:has(.home-page) .daily-month { gap:0; }
  body:has(.home-page) .daily-month button { min-height:44px; }
  body:has(.home-page) .daily-mini { padding:8px; }
}
/* Phones and tablets share the existing drawer; desktop keeps the 196px rail. */
@media (max-width:1200px) {
  .cis-ui-shell:not(:has(.login-page)) > header { padding:0 10px; gap:8px; }
  .cis-ui-shell:not(:has(.login-page)) > header .brand { min-height:44px; }
  .cis-ui-shell:not(:has(.login-page)) > header .brand-lockup { width:92px; height:21px; max-height:21px; }
  .cis-ui-shell:not(:has(.login-page)) > header #shell-menu { display:grid; place-items:center; width:44px; min-width:44px; height:44px; min-height:44px; padding:0; font-size:0; }
  #shell-menu > svg { display:block; width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; }
  .cis-ui-shell:not(:has(.login-page)) :is(.header-cis-control,#cis-name) { flex:1 1 auto; width:auto; max-width:none; }
  .cis-ui-shell:not(:has(.login-page)) :is(#cis-select,#cis-name) { height:44px; min-height:44px; padding:8px 9px; font-size:11px; }
  .cis-ui-shell:not(:has(.login-page)) #cis-select { padding-right:20px; }
  .cis-ui-shell:not(:has(.login-page)) #auth-button { width:44px; min-width:44px; height:44px; min-height:44px; padding:0; margin-left:0; font-size:0; justify-content:center; gap:0; }
  .cis-ui-shell:not(:has(.login-page)) > .shell { display:block; }
  .cis-ui-shell:not(:has(.login-page)) > .shell > aside { position:fixed; top:60px; bottom:0; left:0; height:auto; width:min(328px,88vw); padding:12px 10px; transform:translateX(-102%); z-index:40; }
  .cis-ui-shell:not(:has(.login-page)) #nav :is(button,.button-link) { min-height:48px; padding:11px 12px; font-size:14px; }
  .cis-ui-shell:not(:has(.login-page)) #nav [aria-current=page] { padding-left:9px; }
  .cis-ui-shell:not(:has(.login-page)) #nav .ui-icon { width:20px; height:20px; flex-basis:20px; }
  .cis-ui-shell:not(:has(.login-page)) #shell-scrim { display:none; position:fixed; inset:60px 0 0; z-index:38; width:100%; height:calc(100dvh - 60px); padding:0; border:0; border-radius:0; background:#000a; }
  body.cis-ui-shell.cis-nav-open { overflow:hidden; }
  .cis-ui-shell.cis-nav-open:not(:has(.login-page)) > .shell > aside { transform:none; }
  .cis-ui-shell.cis-nav-open:not(:has(.login-page)) #shell-scrim { display:block; }
  .cis-ui-shell:not(:has(.login-page)) > .shell > #main { padding:22px 12px 28px; }
  .cis-ui-shell:not(:has(.login-page)) #patch-version { margin-left:0; }
}
@media (max-width:700px) {
  .home-page .daily-hero h1 { font-size:27px; }
  .home-page .daily-hero { margin-bottom:16px; }
  .home-layout { gap:14px; }
  .home-page .daily-shifts { grid-template-columns:1fr; }
  .home-page .daily-shift + .daily-shift { border-left:0; border-top:1px solid #292c30; }
  .home-page .section-head { padding:12px; }
  .home-page .home-notice > summary { padding:12px; }
  .home-page .home-title { flex-basis:100%; }
  .home-page .home-heading .actions { width:100%; }
  body:has(.home-page) #toast { bottom:12px; }
  body:has(.home-page) .daily-plan-footer { position:static; }
  body:has(.home-page) .daily-plan-grid { grid-template-columns:minmax(0,1fr); }
  body:has(.home-page) .daily-template-row { flex-wrap:wrap; }
  body:has(.home-page) .daily-template-actions { flex-wrap:wrap; }
}
@media (pointer:coarse) {
  .home-page :is(button,summary),body:has(.home-page) dialog button { min-height:44px; }
  label.home-check,.daily-add label.home-check { min-height:44px; min-width:44px; padding:10px; }
}
/* Keep the existing PWA controls reachable in the shared touch shell.
 * Respect pwa.js [hidden] state; no install/update behavior or SW changes. */
@media (max-width:1050px), (pointer:coarse) {
  .cis-ui-shell:not(:has(.login-page)) .shell > aside #install-app:not([hidden]) { display:block; min-height:44px; }
  .cis-ui-shell:not(:has(.login-page)) #update-app { min-height:44px; }
  .cis-ui-shell:not(:has(.login-page)) #dialog:has(.pwa-install-help) button { min-width:44px; min-height:44px; }
}
@media (forced-colors:active) { .home-check-mark { color:CanvasText; } .home-check > input:checked + .home-check-mark { color:Highlight; } }
