body.next-first-active #app {
  zoom: 1 !important;
  height: 100dvh;
  min-height: 100dvh;
  padding: 0;
  overflow: hidden;
}

body.next-first-active .ambient-bg {
  display: none;
}

/* Zoom controls stay at device size so they remain reachable at every setting. */
html .dayview-zoom-overlay .dayview-zoom-card {
  padding: 12px !important;
  border-radius: 12px !important;
  background: var(--surface-solid) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-subtle) !important;
}
.dayview-zoom-heading { display: flex; align-items: center; gap: 12px; }
.dayview-zoom-heading h2 { margin: 0; flex: 1; font: 600 16px/1.4 'DM Sans', sans-serif; }
.dayview-zoom-heading .drawer-zoom-value { color: var(--accent-warm) !important; }
.dayview-zoom-card .drawer-zoom-row { grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 8px; }
.dayview-zoom-step, .dayview-zoom-card .dayview-zoom-close {
  width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-primary); font-size: 22px;
}
.dayview-zoom-step:disabled { opacity: .38; }
.dayview-zoom-step:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: -2px; }
.dayview-zoom-card .drawer-zoom-reset { display: block; width: 100%; min-height: 44px; margin-top: 6px; border-radius: 6px; color: var(--text-primary); }
.dayview-zoom-card .drawer-zoom-slider { height: 44px; background: transparent !important; border: 0 !important; box-shadow: none !important; }
.dayview-zoom-card .drawer-zoom-slider::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--border-gold); }
.dayview-zoom-card .drawer-zoom-slider::-webkit-slider-thumb { margin-top: -7px; border-color: var(--surface-solid); }
.dayview-zoom-card .drawer-zoom-slider::-moz-range-track { height: 4px; background: var(--border-gold); }
.dayview-zoom-card .drawer-zoom-slider::-moz-range-thumb { border-color: var(--surface-solid); }
@media (max-height: 420px) { .dayview-zoom-overlay { padding-bottom: 18px; } }

/* Legacy detail sheets use the app scale, so cap their painted height after zoom. */
html:root body :is(#clientModal, #summaryModal) .modal-content {
  max-height: calc((100dvh - 40px) / var(--dayview-app-zoom, .8)) !important;
}
html:root body :is(#clientModal, #summaryModal) .modal-header {
  flex: 0 0 auto !important;
  gap: 12px;
}
html:root body :is(#clientModal, #summaryModal) .modal-title {
  min-width: 0;
  overflow-wrap: anywhere;
}
html:root body :is(#clientModal, #summaryModal) .close-btn {
  flex: 0 0 calc(44px / var(--dayview-app-zoom, .8));
  width: calc(44px / var(--dayview-app-zoom, .8)) !important;
  height: calc(44px / var(--dayview-app-zoom, .8)) !important;
}
html:root body :is(#clientModal, #summaryModal) .modal-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
}
@media (pointer: coarse), (max-width: 600px) {
  html * { scrollbar-width: none !important; }
  html *::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }
}

html.next-first-active,
html.next-first-active body { scrollbar-width: none; }
html.next-first-active::-webkit-scrollbar,
html.next-first-active body::-webkit-scrollbar { width: 0; height: 0; }

/* Home owns its dock; background comms refreshes set an inline display value. */
body.next-first-active > #pageOverlay:not(.active) ~ .comms-dock {
  display: none !important;
}

.next-first-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #080908;
}

.next-first-notification-host {
  position: fixed;
  inset: 0;
  z-index: 2200;
  pointer-events: none;
}

.next-first-notification-trigger {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.next-first-notification-host .dashboard-notify-panel {
  position: absolute;
  top: calc(62px + env(safe-area-inset-top, 0px));
  right: 12px;
  left: auto;
  width: min(312px, calc(100vw - 24px));
  transform: none;
  pointer-events: auto;
}

body .comms-dock {
  grid-template-columns: repeat(3, 1fr);
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  border-top-color: rgba(195, 164, 114, .42);
  background: linear-gradient(180deg, rgba(8, 9, 8, .99), rgba(5, 6, 5, 1));
}

body .comms-dock::before { display: none; }
body .comms-dock-btn { flex-direction: column; gap: 3px; min-width: 0; padding: 7px 2px 5px; }
body .comms-dock-icon { width: 22px; height: 22px; color: var(--text-primary); }
body .comms-dock-label { color: var(--text-primary); font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; }
body .comms-dock-btn.active .comms-dock-icon,
body .comms-dock-btn.active .comms-dock-label { color: var(--accent-primary); }
body .comms-dock-badge { top: 4px; left: calc(50% + 7px); }
html[data-theme='light'] body .comms-dock { background: rgba(255, 253, 248, .99); }

.next-first-home {
  --nf-surface: rgba(12, 14, 12, .96);
  --nf-paper: #10120e;
  --nf-ink: #f4efe5;
  --nf-muted: #b8b4a5;
  --nf-faint: #979987;
  --nf-gold: #c3a472;
  --nf-gold-hi: #e4c994;
  --nf-gold-wash: rgba(195, 164, 114, .085);
  --nf-line: rgba(195, 164, 114, .22);
  --nf-strong: rgba(195, 164, 114, .49);
  --nf-green: #94c4a4;
  --nf-blue: #afc4d4;
  --nf-shadow: 0 5px 18px rgba(0, 0, 0, .24);
  --nf-texture: url('/assets/dayview-next-first/texture-dark.png');
  position: relative;
  min-height: calc(100dvh - 64px);
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0 16px 24px;
  color: var(--nf-ink);
  font: 13px/1.45 'DM Sans', 'Segoe UI', Arial, sans-serif;
  isolation: isolate;
}

.next-first-home::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  margin: 0 -1px;
  background: var(--nf-texture) center top / 430px 892px repeat-y;
  opacity: .44;
  pointer-events: none;
}

html[data-theme='light'] .next-first-home {
  --nf-surface: rgba(255, 253, 248, .96);
  --nf-paper: #fffdf7;
  --nf-ink: #302b22;
  --nf-muted: #6e6555;
  --nf-faint: #786f5e;
  --nf-gold: #926c30;
  --nf-gold-hi: #755017;
  --nf-gold-wash: rgba(166, 122, 54, .075);
  --nf-line: rgba(137, 102, 45, .23);
  --nf-strong: rgba(137, 102, 45, .46);
  --nf-green: #417852;
  --nf-blue: #486879;
  --nf-shadow: 0 5px 18px rgba(77, 55, 20, .055);
  --nf-texture: url('/assets/dayview-next-first/texture-light.png');
}

html[data-theme='light'] .next-first-home::before { opacity: .56; }
.next-first-home * { box-sizing: border-box; }
.next-first-home button,
.next-first-home a {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: inherit;
  font: inherit;
  text-decoration: none;
}
.next-first-home button:focus-visible { outline: 2px solid var(--nf-gold-hi); outline-offset: 3px; }
.next-first-home svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.nf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 79px;
  margin: 0 -16px;
  padding: 16px 18px 12px;
  background: linear-gradient(180deg, var(--bg-primary) 20%, transparent);
}

.nf-greeting { margin: 0; color: var(--nf-muted); font-size: 10px; line-height: 14px; }
.nf-name { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--nf-gold-hi); font: 600 24px/29px Georgia, 'Times New Roman', serif; letter-spacing: -.45px; }
.nf-name img { width: 14px; height: 14px; object-fit: contain; }
.nf-header-actions { display: flex; align-items: center; margin-right: -5px; }
.nf-icon-btn { position: relative; display: grid; place-items: center; width: 40px; height: 44px; color: var(--nf-gold-hi); }
.nf-icon-btn svg { width: 18px; height: 18px; }
.nf-theme-btn::before { content: ''; position: absolute; inset: 5px 4px; z-index: -1; border: 1px solid var(--nf-line); border-radius: 50%; background: var(--nf-gold-wash); }
.nf-bell { width: 26px; height: 30px; object-fit: contain; }

.nf-datebar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 46px; margin-bottom: 7px; }
.nf-date-title { margin: 0; font: 400 24px/27px Georgia, 'Times New Roman', serif; letter-spacing: -.6px; }
.nf-date-sub { margin: 3px 0 0; color: var(--nf-faint); font-size: 9px; line-height: 14px; }
.nf-day-arrows { display: flex; align-items: center; gap: 1px; color: var(--nf-gold); }
.next-first-home .nf-day-arrows button { display: grid; place-items: center; width: 34px; min-height: 44px; }
.nf-day-arrows svg { width: 14px; height: 14px; }
.nf-day-arrows button[disabled] { visibility: hidden; }

.nf-weatherline { display: flex; align-items: center; gap: 7px; min-height: 28px; padding: 0 0 8px; color: var(--nf-muted); font-size: 10px; }
.nf-weatherline svg { width: 15px; height: 15px; color: var(--nf-gold); }
.nf-weatherline .nf-road { margin-left: auto; color: var(--nf-faint); font-size: 9px; text-align: right; }
.nf-weatherline.loading { opacity: .72; }

.nf-metrics { display: grid; grid-template-columns: repeat(3, 1fr); padding: 10px 0; border-top: 1px solid var(--nf-strong); border-bottom: 1px solid var(--nf-line); background: linear-gradient(100deg, var(--nf-gold-wash), transparent); }
.nf-metric { position: relative; min-width: 0; min-height: 39px; text-align: center; }
.nf-metric + .nf-metric::before { content: ''; position: absolute; top: 5px; left: 0; width: 1px; height: 28px; background: var(--nf-line); }
.nf-metric-value { display: block; color: var(--nf-gold-hi); font: 400 24px/27px Georgia, 'Times New Roman', serif; letter-spacing: -.55px; white-space: nowrap; }
.nf-metric-value em { font: 11px 'DM Sans', 'Segoe UI', Arial, sans-serif; font-style: normal; letter-spacing: 0; }
.nf-metric-label { display: block; margin-top: 3px; color: var(--nf-muted); font-size: 8px; line-height: 12px; letter-spacing: 1px; text-transform: uppercase; }

.nf-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 35px; margin-top: 7px; }
.nf-section-heading h2 { margin: 0; color: var(--nf-gold); font-size: 9px; font-weight: 600; letter-spacing: 1.7px; text-transform: uppercase; }
.nf-section-heading span { color: var(--nf-faint); font-size: 9px; }
.nf-surface { overflow: hidden; border: 1px solid var(--nf-line); border-radius: 3px; background: var(--nf-surface); box-shadow: var(--nf-shadow); }
.nf-focus-card { border-color: var(--nf-strong); border-top-color: var(--nf-gold); background: linear-gradient(120deg, var(--nf-gold-wash), transparent 70%), var(--nf-surface); box-shadow: 0 5px 24px rgba(0, 0, 0, .14); }
.nf-focus-heading { display: grid; grid-template-columns: 64px minmax(0, 1fr) 30px; gap: 10px; align-items: center; width: 100%; min-height: 76px; padding: 13px 12px 9px; text-align: left; }
.nf-focus-time { padding-right: 10px; border-right: 1px solid var(--nf-line); color: var(--nf-gold-hi); }
.nf-focus-time strong { display: block; font: 400 24px/27px Georgia, 'Times New Roman', serif; letter-spacing: -.8px; }
.nf-focus-time small { display: block; margin-top: 2px; color: var(--nf-faint); font-size: 8px; line-height: 13px; }
.nf-client { display: block; overflow: hidden; color: var(--nf-ink); font-size: 15px; font-weight: 600; letter-spacing: -.25px; text-overflow: ellipsis; white-space: nowrap; }
.nf-service { display: block; margin-top: 2px; color: var(--nf-muted); font-size: 10px; line-height: 15px; }
.nf-brand { color: var(--nf-blue); font-size: 8px; letter-spacing: .3px; }
.nf-art { width: 28px; height: 30px; object-fit: contain; }
.nf-focus-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 12px 10px; color: var(--nf-muted); font-size: 9px; }
.nf-location { display: flex; align-items: center; gap: 5px; min-width: 0; }
.nf-location svg { width: 12px; height: 12px; color: var(--nf-faint); }
.nf-ready { display: inline-flex; align-items: center; gap: 4px; color: var(--nf-green); white-space: nowrap; }
.nf-ready::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.nf-ready.needs-review { color: var(--nf-gold-hi); }
.nf-focus-travel { display: flex; align-items: center; justify-content: space-between; gap: 7px; width: 100%; padding: 8px 12px; border-top: 1px solid var(--nf-line); border-bottom: 1px solid var(--nf-line); background: var(--nf-gold-wash); color: var(--nf-muted); font-size: 10px; text-align: left; }
.nf-focus-travel strong { color: var(--nf-gold-hi); font-weight: 600; }
.nf-focus-travel span:last-child { color: var(--nf-faint); font-size: 9px; }
.nf-focus-actions { display: grid; grid-template-columns: 1fr 1fr 31px; gap: 8px; padding: 9px 11px; }
.next-first-home .nf-action { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 41px; padding: 8px 10px; border: 1px solid var(--nf-strong); border-radius: 2px; color: var(--nf-gold-hi); font-size: 10px; font-weight: 600; }
.next-first-home .nf-action.primary { border-color: var(--nf-gold); background: var(--nf-gold); color: #17140e; }
html[data-theme='light'] .nf-action.primary { border-color: #8b6328; background: #8b6328; color: #fffdf7; }
.nf-action svg { width: 16px; height: 16px; }
.nf-more { display: grid; place-items: center; min-height: 41px; color: var(--nf-gold); }


.nf-later-card { display: flex; align-items: center; gap: 10px; min-height: 75px; padding: 0 8px 0 11px; border: 1px solid var(--nf-line); border-radius: 3px; background: var(--nf-surface); }
.nf-later-main { display: grid; grid-template-columns: 51px 24px minmax(0, 1fr); gap: 10px; align-items: center; min-width: 0; min-height: 74px; flex: 1; text-align: left; }
.nf-later-time { color: var(--nf-gold-hi); font: 400 20px/24px Georgia, 'Times New Roman', serif; letter-spacing: -.5px; }
.nf-later-time small { display: block; margin-top: 3px; color: var(--nf-faint); font: 8px/13px 'DM Sans', 'Segoe UI', Arial, sans-serif; letter-spacing: 0; }
.nf-later-card .nf-art { width: 23px; height: 27px; }
.nf-later-card .nf-client { font-size: 12px; }
.nf-later-card .nf-service { font-size: 9px; }

.nf-travel-leg { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); min-height: 53px; }
.nf-travel-rail { position: absolute; top: 0; left: 13px; display: block; overflow: hidden; width: 9px; height: 100%; fill: none; stroke-width: 1; pointer-events: none; }
.nf-travel-rail .stem { stroke: var(--nf-strong); vector-effect: non-scaling-stroke; }
.nf-travel-rail .node { fill: none; stroke: var(--nf-gold); }
.nf-travel-main { grid-column: 2; display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 12px; grid-template-rows: minmax(15px, auto) minmax(13px, auto); gap: 2px 8px; align-content: center; align-items: center; width: 100%; min-height: 53px; padding: 9px 0; color: var(--nf-muted); text-align: left; }
.nf-travel-main > svg { grid-row: 1 / 3; width: 16px; height: 16px; color: var(--nf-faint); stroke-width: 1.3; }
.nf-travel-copy { display: contents; }
.nf-travel-copy strong { grid-column: 2; grid-row: 1; min-width: 0; font-size: 10px; line-height: 15px; font-weight: 400; }
.nf-travel-copy strong span { color: var(--nf-faint); font-size: 8px; }
.nf-travel-copy small { grid-column: 2; grid-row: 2; color: var(--nf-faint); font-size: 8px; line-height: 13px; font-variant-numeric: tabular-nums; }
.nf-travel-slack { display: contents; color: var(--nf-green); text-align: right; }
.nf-travel-slack strong { grid-column: 3; grid-row: 1; font-size: 10px; line-height: 15px; font-weight: 400; white-space: nowrap; }
.nf-travel-slack small { grid-column: 3; grid-row: 2; color: var(--nf-faint); font-size: 7px; line-height: 13px; }
.nf-travel-chevron { grid-column: 4; grid-row: 1 / 3; width: 12px !important; height: 12px !important; color: var(--nf-gold) !important; }

.nf-empty { padding: 40px 12px 48px; text-align: center; }
.nf-empty h2 { margin: 0 0 9px; color: var(--nf-gold-hi); font: 400 27px/32px Georgia, 'Times New Roman', serif; }
.nf-empty p { margin: 0; color: var(--nf-muted); font-size: 12px; }

@media (max-width: 365px) {
  .next-first-home { padding-right: 12px; padding-left: 12px; }
  .nf-header { margin-right: -12px; margin-left: -12px; padding-right: 14px; padding-left: 14px; }
  .nf-focus-heading { grid-template-columns: 58px minmax(0, 1fr) 26px; gap: 8px; }
  .nf-focus-heading .nf-client { font-size: 14px; }
  .nf-focus-time strong { font-size: 22px; }
  .nf-focus-meta, .nf-focus-travel { font-size: 8px; }
  .nf-focus-actions { gap: 6px; }
}
