/* The Book: Calendar contextual L1 PUP adapter, 23 November 2026.
   Applies the approved visual language without replacing working Calendar actions.
   The existing Calendar popup owns its positioning and lifecycle until L2/L3 migration. */
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1{
  --pup-surface:var(--surface,#172123);
  --pup-raised:var(--surface-alt,#1d2a2d);
  --pup-stroke:var(--border,#315054);
  --pup-fg:var(--text,#edf5f4);
  --pup-subtle:var(--muted,#a4b5b8);
  --pup-accent:var(--primary,#19bab4);
  box-sizing:border-box;
  width:min(360px,calc(100vw - 24px));
  max-height:calc(100dvh - 24px);
  padding:12px 14px;
  border:1px solid var(--pup-stroke);
  border-radius:16px;
  background:var(--pup-surface);
  color:var(--pup-fg);
  box-shadow:0 18px 52px rgba(0,0,0,.34);
  font:inherit;
  font-size:13px;
  line-height:1.5;
  scrollbar-width:thin;
  overscroll-behavior:contain;
}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 :is(.book-calendar-view-actions,.book-l1-toolbar){
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  align-items:center;
  gap:3px;
  margin:0 0 10px;
  padding:0 0 8px;
  border-bottom:1px solid var(--pup-stroke);
}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 :is(.book-calendar-view-actions,.book-l1-toolbar) button{
  display:inline-grid;
  place-items:center;
  width:40px;
  height:40px;
  min-width:40px;
  min-height:40px;
  padding:6px;
  border:1px solid transparent;
  border-radius:8px;
  background:transparent;
  color:var(--pup-subtle);
  cursor:pointer;
  font:inherit;
  line-height:1;
}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 :is(.book-calendar-view-actions,.book-l1-toolbar) button:hover{
  border-color:var(--pup-stroke);
  background:var(--pup-raised);
  color:var(--pup-fg);
}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 :is(.book-calendar-view-actions,.book-l1-toolbar) button:focus-visible,
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 button:focus-visible,
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 select:focus-visible{
  outline:2px solid var(--pup-accent);
  outline-offset:2px;
}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-calendar-view-title-row{
  display:flex;
  align-items:flex-start;
  gap:8px;
  margin:0 0 8px;
}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-calendar-view-title-row h3{
  margin:0 0 5px;
  color:var(--pup-fg);
  font-size:18px;
  font-weight:650;
  line-height:1.3;
}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-calendar-view-when{
  color:var(--pup-fg);
  font-size:13px;
  line-height:1.45;
}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-calendar-view-repeat{
  margin-top:5px;
  color:var(--pup-subtle);
  font-size:12px;
}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-calendar-view-info{
  display:grid;
  grid-template-columns:20px minmax(0,1fr);
  align-items:start;
  gap:10px;
  margin:3px 0;
  padding:3px 0;
  color:var(--pup-fg);
  font-size:13px;
}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-calendar-view-symbol{
  color:var(--pup-subtle);
}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-calendar-view-tasks{
  display:grid;
  grid-template-columns:20px minmax(0,1fr);
  align-items:start;
  gap:10px;
  margin-top:8px;
  padding-top:9px;
  border-top:1px solid var(--pup-stroke);
  font-size:13px;
}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-calendar-view-tasks > div{
  min-width:0;
}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-calendar-view-tasks strong{
  color:var(--pup-fg);
  font-weight:650;
}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-calendar-view-tasks ul{
  margin:8px 0;
}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 :is(.book-day-draft-more, [data-book-popup-task-select]){
  min-height:34px;
  padding:7px 10px;
  border:1px solid var(--pup-stroke);
  border-radius:8px;
  background:var(--pup-raised);
  color:var(--pup-fg);
  font:inherit;
  font-size:12px;
  cursor:pointer;
}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 :is(input,select,textarea){
  max-width:100%;
  border:1px solid var(--field-border,var(--pup-stroke));
  border-radius:8px;
  background:var(--pup-surface);
  color:var(--pup-fg);
  font:inherit;
  font-size:13px;
}
@media(max-width:600px){
  :is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1{
    padding:12px 14px;
    max-height:calc(100dvh - 20px);
  }
  :is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 :is(.book-calendar-view-actions,.book-l1-toolbar){
    gap:3px;
    margin-bottom:10px;
  }
  :is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-calendar-view-title-row h3{font-size:17px}
}
.book-pup-host .book-pup-layer[data-book-pup-level="1"] :is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1{width:min(360px,calc(100vw - 24px))}
@media(min-width:504px){
  :is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 :is(.book-calendar-view-actions,.book-l1-toolbar){flex-wrap:nowrap;justify-content:flex-end}
  :is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 :is(.book-calendar-view-actions,.book-l1-toolbar) button{flex:0 0 auto;white-space:nowrap}
}

/* Shared Calendar L1 fixed elements — approved compact icon-only design. */
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-l1-toolbar button span{display:none}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-l1-toolbar button:disabled{opacity:.3;cursor:not-allowed}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-l1-toolbar svg{width:18px;height:18px}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-l1-toolbar button[aria-pressed="true"]{color:var(--pup-accent);background:var(--pup-raised)}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-l1-section{margin-top:8px;padding-top:9px}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-l1-action-row{display:flex;align-items:center;gap:9px;width:100%;padding:7px 0;background:none;border:0;text-align:left;min-height:40px}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-l1-action-row[hidden]{display:none}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-l1-action-row span{flex:1}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-l1-action-row svg{width:18px;height:18px;flex:none;color:var(--pup-subtle)}
:is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-l1-action-row:hover:not(:disabled){background:var(--pup-raised)}
.book-pup-layer[data-book-pup-level="1"]:has(>.book-calendar-l1-frost)>.book-pup-backdrop{background:rgba(16,23,25,.25);-webkit-backdrop-filter:blur(5px);backdrop-filter:blur(5px)}
@media(max-width:350px){
  :is(.book-calendar-view-popover,.book-courtesy-popover,.book-week-summary-popover).book-pup-l1 .book-l1-toolbar button{width:36px;height:36px;min-width:36px;min-height:36px}
}

/* All-day summaries share the L1 shell and toolbar; the row list remains contextual. */
.book-week-summary-popover.book-pup-l1 .book-summary-toolbar>[data-book-summary-actions]{display:contents}
.book-week-summary-popover.book-pup-l1 .book-summary-toolbar>button[data-book-summary-close]{position:relative;flex-shrink:0;margin-inline-start:5px}
.book-week-summary-popover.book-pup-l1 .book-summary-toolbar>button[data-book-summary-close]::before{content:"";position:absolute;inset-inline-start:-5px;top:8px;bottom:8px;width:1px;background:var(--pup-border,var(--border));pointer-events:none}
.book-week-summary-popover.book-pup-l1 .book-summary-toolbar:has([data-book-summary-action="future"]) button{width:36px;height:36px;min-width:36px;min-height:36px}
.book-week-summary-popover.book-pup-l1 .book-week-summary-title{font-size:12px;color:var(--pup-subtle);padding:0 0 10px}
.book-week-summary-popover.book-pup-l1 .book-week-summary-list{max-height:none;overflow:visible}
.book-week-summary-popover.book-pup-l1 .book-week-summary-entry strong{font-size:13px;white-space:normal;overflow-wrap:anywhere}
.book-week-summary-popover.book-pup-l1 .book-week-summary-entry small{font-size:11px;white-space:normal;overflow-wrap:anywhere}
@media(max-width:600px){
  .book-week-summary-popover.book-pup-l1 .book-week-summary-entry{touch-action:pan-y!important}
  .book-week-summary-popover.book-pup-l1 .book-summary-toolbar{flex-wrap:wrap}
}
