/* Almanack: cozy nighttime Animal Crossing storybook planner theme. */
:root {
  --font-display: ui-rounded, "Hiragino Maru Gothic ProN", "Quicksand", "Varela Round", "Trebuchet MS", system-ui, sans-serif;
  --font-ui: ui-rounded, "Hiragino Maru Gothic ProN", "Quicksand", "Varela Round", "Trebuchet MS", system-ui, sans-serif;
  --font-label: ui-rounded, "Hiragino Maru Gothic ProN", "Quicksand", "Varela Round", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --radius-control: 999px;
  --radius-sheet: 24px;
  --button: 38px;

  --night-sky: #131d21;
  --alm-bg: #131d21;
  --alm-surface: #28231e;
  --alm-surface-2: #312b24;
  --alm-card: #383129;
  --alm-card-hover: #433a30;
  --alm-cell: #312b24;
  --alm-cell-hover: #3c342b;
  --alm-line: #4d4135;
  --alm-line-strong: #5c4e3f;
  --alm-paper-highlight: rgb(251 244 228 / .08);
  --alm-paper-shadow: rgb(0 0 0 / .42);
  --alm-chip-base: #312b24;
  --alm-pane: #28231e;
  --alm-pane-solid: #28231e;
  --alm-busy-a: rgb(251 244 228 / .04);
  --alm-busy-b: rgb(251 244 228 / .14);
  --alm-busy-edge: rgb(251 244 228 / .34);
  --alm-role-bg: rgb(251 244 228 / .12);

  --ui-text: #fbf4e4;
  --ui-title: #fbf4e4;
  --ui-muted: #c2b39b;
  --ui-text-soft: #c2b39b;
  --ui-label: #c2b39b;
  --ui-highlight: #7dd9a8;
  --ui-warn: #f7cf63;
  --alm-ok: #7dd9a8;
  --alm-bad: #f59786;
  --alm-pause: #f7cf63;
  --alm-today: #f7cf63;
  --alm-today-ink: #2b210e;
  --mint: #7dd9a8;
  --mint-dark: #3f8f66;
  --honey: #f7cf63;
  --honey-dark: #b98b24;
  --peach: #f59786;

  --button-main: #7dd9a8;
  --button-main-hover: #8ce3b5;
  --button-main-ink: #16281f;
  --button-main-rim: 0 3px 0 #3f8f66;
  --focus-ring: 0 0 0 2px #28231e, 0 0 0 4px #7dd9a8;
  --alm-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fbf4e4' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: dark;
}

@keyframes bookOpen { from { transform: translateY(18px) scale(.96); opacity: 0; } }
@keyframes almRise { from { transform: scale(.95) translateY(10px); opacity: 0; } }
@keyframes almPageNext { from { transform: rotateY(-12deg) translateX(26px); opacity: 0; } }
@keyframes almPagePrev { from { transform: rotateY(12deg) translateX(-26px); opacity: 0; } }
@keyframes almFolioIn { from { transform: scale(.88) translateY(10px); opacity: 0; } }
@keyframes almSheetIn { from { transform: translateY(16px) scale(.94); opacity: 0; } }
@keyframes almPulse { 50% { opacity: .45; transform: scale(1.25); } }
@keyframes floatBob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-3px) rotate(5deg); } }
@keyframes twinkle { from { opacity: .35; transform: scale(.85); } to { opacity: 1; transform: scale(1.15); } }
@keyframes cloudDrift { from { transform: translateX(-140px); } to { transform: translateX(1560px); } }
@keyframes fireflyDrift {
  0%, 100% { transform: translate(0, 0) scale(.85); opacity: .45; }
  35% { transform: translate(18px, -22px) scale(1.15); opacity: 1; }
  70% { transform: translate(-14px, -36px) scale(.95); opacity: .75; }
}
@keyframes stampThump {
  0% { transform: scale(1.45) rotate(-14deg); }
  60% { transform: scale(.9) rotate(-4deg); }
  100% { transform: scale(1) rotate(-8deg); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  position: relative;
  font: 600 15px/1.4 var(--font-ui);
  color: var(--ui-text);
  background: linear-gradient(180deg, #0d1722 0%, #162933 48%, #1d3538 100%);
  padding: 16px 22px 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

/* Cozy animated night sky background */
.cozy-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.cozy-bg svg.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bg-cloud { animation: cloudDrift 48s linear infinite; }
.bg-cloud.slow { animation-duration: 72s; animation-delay: -24s; }
.bg-star { animation: twinkle 3.6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.bg-star.s2 { animation-delay: -1.4s; animation-duration: 4.4s; }
.bg-star.s3 { animation-delay: -2.6s; animation-duration: 5.1s; }
.firefly {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffe484;
  box-shadow: 0 0 10px 3px rgb(247 207 99 / .65), 0 0 22px 6px rgb(125 217 168 / .25);
  animation: fireflyDrift 9s ease-in-out infinite;
  opacity: .85;
}
.firefly.f1 { left: 8%; top: 72%; animation-duration: 8s; }
.firefly.f2 { left: 22%; top: 84%; animation-duration: 11s; animation-delay: -3s; width: 5px; height: 5px; }
.firefly.f3 { left: 46%; top: 90%; animation-duration: 9.5s; animation-delay: -5s; }
.firefly.f4 { left: 74%; top: 78%; animation-duration: 10.5s; animation-delay: -2s; width: 6px; height: 6px; }
.firefly.f5 { left: 91%; top: 68%; animation-duration: 8.5s; animation-delay: -6s; }
.firefly.f6 { left: 94%; top: 28%; animation-duration: 12s; animation-delay: -4s; width: 5px; height: 5px; }
.firefly.f7 { left: 4%; top: 34%; animation-duration: 10s; animation-delay: -1s; width: 5px; height: 5px; }

/* Base controls: chunky cozy toy buttons */
button, input, select, textarea { font: inherit; color: inherit; }
button.primary, button.secondary, button.danger, button.icon-btn, #toggle-sidebar, .inv-banner, a.primary, a.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--button);
  padding: 0 15px;
  border-radius: var(--radius-control);
  border: 2px solid var(--alm-line-strong);
  background: var(--alm-card);
  color: var(--ui-text);
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 3px 0 #181410;
  transition: transform .16s var(--bounce), background-color .16s, box-shadow .16s;
}
button.primary:hover:not(:disabled), button.secondary:hover:not(:disabled), button.icon-btn:hover:not(:disabled), #toggle-sidebar:hover:not(:disabled), a.primary:hover, a.secondary:hover {
  background: var(--alm-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #181410;
}
button.primary:active:not(:disabled), button.secondary:active:not(:disabled), button.danger:active:not(:disabled), button.icon-btn:active:not(:disabled), a.primary:active, a.secondary:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #181410;
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
button:disabled { opacity: .52; cursor: not-allowed; }
button.primary, a.primary {
  background: var(--button-main);
  color: var(--button-main-ink);
  border-color: #204c36;
  box-shadow: var(--button-main-rim);
}
button.primary:hover:not(:disabled), a.primary:hover {
  background: var(--button-main-hover);
  box-shadow: 0 5px 0 #3f8f66;
}
button.primary:active:not(:disabled), a.primary:active { box-shadow: 0 1px 0 #3f8f66; }
button.secondary, a.secondary { background: var(--alm-card); }
button.danger {
  background: transparent;
  color: var(--alm-bad);
  border-color: color-mix(in srgb, var(--alm-bad) 55%, transparent);
  box-shadow: none;
}
button.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--alm-bad) 15%, transparent); transform: translateY(-1px); }
.icon-btn { width: var(--button); padding: 0; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; }

input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), select, textarea {
  width: 100%;
  padding: 8px 13px;
  border-radius: 14px;
  border: 2px solid var(--alm-line-strong);
  background: var(--alm-surface-2);
  color: var(--ui-text);
  transition: border-color .18s var(--spring), box-shadow .18s var(--spring);
}
textarea { resize: vertical; }
label { display: grid; gap: 5px; font-size: 13.5px; font-weight: 700; color: var(--ui-muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ui-text); cursor: pointer; }
label.check input { width: 17px; height: 17px; accent-color: var(--mint); }

/* Open ring-bound storybook layout */
.book-wrap {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: clamp(264px, 22vw, 300px) 28px minmax(0, 1fr);
  filter: drop-shadow(0 20px 36px rgb(0 0 0 / .5));
  animation: bookOpen .65s var(--bounce) backwards;
}
.page {
  position: relative;
  background: var(--alm-surface);
  border: 3px solid var(--alm-line-strong);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.page::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1.5px dashed rgb(251 244 228 / .12);
  border-radius: inherit;
  pointer-events: none;
}
.page-left {
  border-radius: 24px 10px 10px 24px;
  box-shadow: -5px 6px 0 #1c1814, -9px 10px 0 #352d25;
  overflow: hidden;
}
.page-right {
  border-radius: 10px 24px 24px 10px;
  box-shadow: 5px 6px 0 #1c1814, 9px 10px 0 #352d25;
  overflow: hidden;
}

/* Warm bamboo/honey spiral rings */
.spine {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
  padding: 24px 0;
  z-index: 4;
  pointer-events: none;
}
.ring {
  width: 36px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fae29c 0%, #d49c3d 55%, #8f6118 100%);
  border: 2px solid #2b2113;
  box-shadow: 0 3px 5px rgb(0 0 0 / .4);
  transform: rotate(-5deg);
}

/* Sidebar (left page) */
.alm-side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 16px 11px;
  border-bottom: 2px dashed var(--alm-line-strong);
}
.alm-brand-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  border: 2px solid var(--alm-line-strong);
  background: var(--alm-card);
  flex: 0 0 auto;
  text-decoration: none;
  box-shadow: 0 3px 0 #1a1612;
  transition: transform .22s var(--bounce);
}
.alm-brand-link:hover { transform: rotate(-10deg) scale(1.08); }
.alm-brand-link img { display: block; width: 24px; height: 24px; }
.alm-side-title { display: grid; gap: 1px; min-width: 0; }
.alm-side-title strong { font: 800 20px/1.1 var(--font-display); color: var(--ui-title); }
.alm-chronicle { font: 700 12px/1.2 var(--font-ui); color: var(--mint); font-variant-numeric: tabular-nums; }
.celestial { margin-left: auto; width: 28px; height: 28px; flex: none; animation: floatBob 3.8s ease-in-out infinite; }

/* Polka-dot washi-taped Up Next sticky card */
.up-next-card {
  position: relative;
  margin: 14px 14px 4px;
  padding: 12px 14px 11px;
  background: #3d3426;
  border: 2.5px solid #6e5b3f;
  border-radius: 18px;
  box-shadow: 0 5px 0 #201a12;
  transform: rotate(-1.4deg);
  transition: transform .24s var(--bounce);
  cursor: pointer;
}
.up-next-card:hover { transform: rotate(.5deg) translateY(-3px) scale(1.02); }
.up-next-card::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(2deg);
  width: 60px;
  height: 15px;
  border-radius: 4px;
  background-color: var(--peach);
  background-image: radial-gradient(rgb(255 255 255 / .55) 2px, transparent 2px);
  background-size: 8px 8px;
  box-shadow: 0 2px 4px rgb(0 0 0 / .25);
}
.up-next-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--honey);
}
.up-next-list { list-style: none; margin: 7px 0 0; padding: 0; display: grid; gap: 5px; }
.up-next-list li { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--ui-text); min-width: 0; }
.up-next-list li span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: rgb(247 207 99 / .18);
  color: var(--honey);
  flex: none;
}

#sidebar .top { padding: 10px 14px 6px; }
#sidebar .top .primary { width: 100%; }
.side-scroll { flex: 1 1 0; overflow-y: auto; padding-bottom: 16px; }
.side-heading {
  margin: 14px 14px 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ui-muted);
}

/* Main column & masthead (right page) */
.alm-masthead {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 2px dashed var(--alm-line-strong);
}
.alm-head-logo { display: none; }
#toggle-sidebar { display: none; width: 38px; padding: 0; position: relative; }
.chat-head { flex: 1 1 auto; min-width: 0; }
.chat-head h1 { margin: 0; font: 800 21px/1.15 var(--font-display); color: var(--ui-title); }
.chat-head .app-name { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.chat-head .tool-description { font: 600 13px/1.3 var(--font-ui); color: var(--ui-muted); }
.prefs { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.alm-lang-select { width: auto !important; min-height: 36px; padding: 4px 10px !important; font-size: 13px; border-radius: 999px !important; }
.alm-auth { display: flex; align-items: center; gap: 8px; }
.alm-auth form { margin: 0; }
.alm-user-name { font-size: 13px; color: var(--honey); font-weight: 800; }
.alm-auth-btn { min-height: 36px; padding: 0 14px; font-size: 13px; }

.shell-pane { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.shell-scroll { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 14px 20px 18px; }

/* Stage & cozy animations */
.stage { perspective: 1400px; }
#stage.anim-rise { animation: almRise .38s var(--bounce) backwards; }
#stage.anim-next { animation: almPageNext .46s var(--spring) backwards; transform-origin: left center; }
#stage.anim-prev { animation: almPagePrev .46s var(--spring) backwards; transform-origin: right center; }
#stage.anim-rise .day,
#stage.anim-next .day,
#stage.anim-prev .day,
#stage .agenda-day {
  animation: almFolioIn .38s var(--bounce) backwards;
  animation-delay: calc(var(--i, 0) * 11ms);
}
.cal-row { transition: background-color .16s var(--spring), transform .18s var(--bounce); }
.day { position: relative; transition: transform .2s var(--bounce), box-shadow .2s var(--spring), border-color .18s, background-color .18s; }
.day:hover { transform: translateY(-3px) rotate(-.4deg); z-index: 2; box-shadow: 0 8px 16px rgb(0 0 0 / .35); }
.day.today {
  background: #3b3224;
  box-shadow: inset 0 0 0 2.5px var(--honey), 0 4px 0 #221c12;
}
.day.today .num {
  transform: rotate(-8deg);
  box-shadow: 0 2px 0 var(--honey-dark);
  animation: stampThump .45s var(--bounce);
}
.tg-day.today { box-shadow: inset 0 3px 0 var(--honey); }
.chip, .ev, .row-btn {
  border-radius: 999px;
  box-shadow: 0 2px 0 rgb(0 0 0 / .28);
  transition: transform .18s var(--bounce), box-shadow .18s;
}
.chip:hover, .ev:hover, .row-btn:hover { transform: translateY(-2px) rotate(-1.4deg) scale(1.03); box-shadow: 0 5px 0 rgb(0 0 0 / .28); }
.now-dot, .tg-now-dot, .now::before { animation: almPulse 2.4s ease-in-out infinite; }

/* Dialog sheets */
dialog.sheet {
  width: min(540px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 22px 24px;
  border-radius: var(--radius-sheet);
  border: 3px solid var(--alm-line-strong);
  background: var(--alm-pane-solid);
  color: var(--ui-text);
  box-shadow: 0 22px 60px rgb(0 0 0 / .55);
}
dialog.sheet[open] { animation: almSheetIn .3s var(--bounce) backwards; }
dialog.sheet.narrow { width: min(440px, calc(100vw - 24px)); }
dialog.sheet::backdrop { background: rgb(10 14 18 / .65); backdrop-filter: blur(4px); }
dialog.sheet form { display: grid; gap: 12px; }
.sheet-title { margin: 0 0 2px; font: 800 22px/1.2 var(--font-display); color: var(--ui-title); }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.sheet-actions .danger { margin-left: auto; }
.message { margin: 0; padding: 9px 12px; border-radius: 14px; background: color-mix(in srgb, var(--alm-bad) 15%, transparent); color: var(--alm-bad); font-size: 13.5px; }
.hint { font-size: 12.5px; color: var(--ui-muted); line-height: 1.4; }
.badge-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--honey); }

/* Mobile drawer */
.alm-backdrop { position: fixed; inset: 0; z-index: 29; background: rgb(10 14 18 / .6); }
@media (max-width: 960px) {
  body { padding: 8px; }
  .book-wrap { grid-template-columns: minmax(0, 1fr); }
  .spine { display: none; }
  #sidebar {
    position: fixed;
    inset: 8px auto 8px 8px;
    width: min(300px, 86vw);
    z-index: 30;
    border-radius: 20px;
    transform: translateX(-110%);
    transition: transform .26s var(--spring);
    box-shadow: 12px 0 36px rgb(0 0 0 / .45);
  }
  body.sidebar-open #sidebar { transform: translateX(0); }
  .page-right { border-radius: 20px; }
  #toggle-sidebar, .alm-head-logo { display: inline-flex; }
  .alm-masthead { padding: 10px 12px; gap: 8px; }
  .chat-head .tool-description, .alm-user-name { display: none; }
  .shell-scroll { padding: 12px; }
}
.muted { margin: 0; }

/* The side list (#sidebar, shell.css): Add calendar on top, then invitations, the mini month, the calendars and a foot with group
   spaces, accounts and the trash, all scrolling under Add calendar */
.alm-side-inv { padding: 0 12px; }
.alm-side-inv:has(> [hidden]) { display: none; }
.mini { padding: 6px 12px 2px; }
#sidebar .side-heading { margin-top: 14px; }
.cal-list { list-style: none; margin: 0; padding: 0 8px 0 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.no-cals { padding: 2px 14px 0; font-size: 14.5px; }
#sidebar .side-foot { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 12px 6px; }
#toggle-sidebar { position: relative; }

/* The pane (.shell-pane, shell.css): toolbar, notices and the stage. Its width, not the screen's, picks the phone layout of the
   calendar (container queries below; isPhone() in almanack.js uses the same 600px). Week and day fill the pane's height. */
#pane-scroll { container: alm-pane / inline-size; display: flex; flex-direction: column; }
#stage:is([data-view="week"], [data-view="day"]) { flex: 1 1 0; min-height: 300px; display: flex; flex-direction: column; }
#stage:is([data-view="week"], [data-view="day"]) > .tg-scroll { flex: 1 1 0; min-height: 0; }

/* Toolbar: symbol buttons (shared symbols.js) of one size; New event is the one with its word */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 14px; }
.nav-group, .view-switch { display: flex; align-items: center; gap: 6px; }
.toolbar button { min-height: var(--button); }
.toolbar button.sym-word { padding: 8px 20px 8px 16px; }
.icon-btn.small { --button: 34px; min-height: 34px !important; height: 34px; }
.range-title { flex: 1 1 200px; min-width: 0; margin: 0; font: 600 26px/1.1 var(--font-display); letter-spacing: 0; color: var(--ui-title); text-align: left; text-wrap: balance; }
.view-switch { padding: 3px; border-radius: var(--radius-control); background: var(--alm-cell); box-shadow: inset 0 0 0 1px var(--alm-line); gap: 3px; }
.view-switch button { --button: 38px; min-height: 38px; }
/* Narrow pane: only the chosen view shows its word, the others are symbols with a tooltip; a wide pane shows all four words */
.view-switch button.sym-word[aria-pressed="false"] { width: var(--button); padding: 0; }
.view-switch button.sym-word[aria-pressed="false"] .sym-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@container alm-pane (min-width: 1000px) {
  .view-switch button.sym-word[aria-pressed="false"] { width: auto; padding: 0 16px 0 12px; }
  .view-switch button.sym-word[aria-pressed="false"] .sym-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
}
.view-switch button[aria-pressed="true"] { background: var(--button-main); color: var(--button-main-ink); box-shadow: var(--button-main-rim); }
.view-switch button[aria-pressed="false"] { background: transparent; box-shadow: none; }
.view-switch button[aria-pressed="false"]:focus-visible { box-shadow: var(--focus-ring); }
.notice { margin: 0 0 12px; padding: 8px 16px; border-radius: 18px; background: var(--alm-cell); box-shadow: inset 0 0 0 1px var(--alm-line); font-size: 15px; color: var(--ui-text); }
.notice[data-kind="warn"] { box-shadow: inset 0 0 0 1px var(--ui-warn); }
.message { margin: 0; color: var(--ui-warn); font-weight: 500; }
.stage { min-width: 0; }

/* Calendars in the side list */
.cal-row { display: flex; align-items: center; gap: 6px; }
.cal-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; margin: 0; min-height: 40px; cursor: pointer; font-size: 15.5px; }
.cal-toggle input { width: 20px; height: 20px; margin: 0; flex: none; }
.cal-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px rgb(255 255 255 / .35); }

.cal-text { display: grid; min-width: 0; gap: 1px; }
.cal-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; min-width: 0; font-size: 12.5px; color: var(--ui-text-soft); line-height: 1.2; }
.cal-sub svg { flex: none; }
.cal-by { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.role-badge { flex: none; display: inline-block; padding: 1px 8px; border-radius: var(--radius-control); background: var(--alm-role-bg); font-size: 12px; font-weight: 700; line-height: 1.4; color: var(--ui-text); white-space: nowrap; }
.cal-row.nested { padding-left: 14px; }
.space-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 40px; margin-top: 6px; border-top: var(--lead-w, 1px) solid var(--lead, var(--alm-line)); padding-top: 6px; }
.space-name { display: flex; align-items: center; gap: 8px; min-width: 0; font: 700 12px/1.2 var(--font-label); letter-spacing: .1em; text-transform: uppercase; color: var(--ui-label); }
.space-name > span:not(.role-badge) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-banner { width: 100%; min-height: 44px; padding: 8px 16px; display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--button-main); color: var(--button-main-ink); box-shadow: var(--button-main-rim); }
.badge-dot { position: absolute; top: 4px; right: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--ui-warn, #e0533f); box-shadow: 0 0 0 2px var(--alm-pane-solid); }
.notice#write-hint { color: var(--ui-text-soft); }

/* Busy blocks: hatched, neutral, not clickable */
.chip.busy, .ev.busy, .row-btn.busy { cursor: default; border-left: 3px solid var(--alm-busy-edge); color: var(--ui-text-soft);
  background: repeating-linear-gradient(135deg, var(--alm-busy-a) 0 5px, var(--alm-busy-b) 5px 10px); }
.chip.busy.allday { background: repeating-linear-gradient(135deg, var(--alm-busy-a) 0 5px, var(--alm-busy-b) 5px 10px); }
.chip.busy .title, .ev.busy .title, .row-btn.busy .row-title { font-weight: 600; font-style: italic; }
.ev.busy { z-index: 0; }
.row-btn.busy { align-items: center; }

/* Mini month */
.mini-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.mini-title { font: 600 18px/1.1 var(--font-display); color: var(--ui-title); text-align: center; flex: 1; text-transform: capitalize; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.mini-dow { font-size: 12px; color: var(--ui-text-soft); padding: 2px 0; }
.mini-day { position: relative; aspect-ratio: 1; min-width: 0; font-size: 13px; }
.mini-day.out { opacity: .5; }
.mini-day.has::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }
.mini-day.today { background: var(--alm-today); color: var(--alm-today-ink); font-weight: 700; }
.mini-day.wk:not(.today) { background: var(--alm-cell-hover); }
.mini-day.sel:not(.today) { box-shadow: inset 0 0 0 2px var(--ui-highlight); }
.mini-day.sel.today { box-shadow: 0 0 0 2px var(--ui-highlight); }

/* Plain buttons inside the grids */
:is(.chip, .ev, .more, .num, .mini-day, .row-btn, .tg-daybtn, .swatch) {
  appearance: none; display: block; margin: 0; padding: 0; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left;
  box-shadow: none; transform: none; cursor: pointer; white-space: normal; min-height: 0; letter-spacing: 0; justify-content: flex-start; align-items: flex-start;
}
:is(.chip, .more, .num, .mini-day, .row-btn, .tg-daybtn):is(:hover, :active):not(:disabled) { background: var(--alm-cell-hover); }
/* chips and swatches carry their own colour: a ring instead of a background, changed instantly (no filter, shadow or transform on hover) */
:is(.ev, .swatch):is(:hover, :active):not(:disabled) { outline: 2px solid rgb(255 255 255 / .6); outline-offset: -2px; }
:is(.chip, .ev, .more, .num, .mini-day, .row-btn, .tg-daybtn, .swatch):focus-visible { outline: 2px solid var(--ui-highlight); outline-offset: 1px; box-shadow: none; }
.mini-day, .day .num { justify-content: center; align-content: center; }
.mini-day { display: grid; place-items: center; border-radius: 50%; text-align: center; }
.mini-day:hover:not(.today) { background: var(--alm-cell-hover); }

/* Event colour: a bar in the calendar's colour on a tinted pane */
.chip, .ev, .row-btn { background: color-mix(in srgb, var(--c) 36%, var(--alm-chip-base)); border-left: 3px solid var(--c); color: var(--ui-text); }
.chip { display: flex; align-items: baseline; gap: 5px; padding: 2px 6px; font-size: 13px; line-height: 1.3; min-width: 0; border-radius: 8px; }
.chip .title, .chip .time { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .time { flex: none; font-variant-numeric: tabular-nums; opacity: .85; }
.chip .title { min-width: 0; font-weight: 600; }
.chip.allday { background: color-mix(in srgb, var(--c) 62%, var(--alm-chip-base)); }
.tz { font-size: 11.5px; opacity: .8; font-style: italic; }
.more { padding: 1px 6px; font-size: 12.5px; color: var(--ui-text-soft); text-decoration: underline; text-underline-offset: 2px; }

/* Month */
#stage[data-view="month"] { flex: 1 1 0; min-height: 420px; display: flex; flex-direction: column; }
.month { flex: 1 1 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 6px; }
.dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; padding: 0 2px; }
.dow span { text-align: left; padding-left: 8px; font: 700 12px/1 var(--font-label); letter-spacing: .1em; text-transform: uppercase; color: var(--ui-label); }
.weeks { display: grid; grid-auto-rows: minmax(64px, 1fr); gap: 4px; min-height: 0; }
.week-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; min-height: 0; }
.day { min-width: 0; min-height: 0; padding: 6px; border-radius: 5px; background: var(--alm-cell); box-shadow: inset 0 0 0 1px var(--alm-line); display: grid; align-content: start; gap: 4px; cursor: default; overflow: hidden; }
.day:hover { background: var(--alm-cell-hover); }
.day.out { opacity: .55; }
.day.sel { box-shadow: inset 0 0 0 2px var(--ui-highlight); }
.day .num { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-size: 14px; font-weight: 600; text-align: center; font-variant-numeric: lining-nums tabular-nums; }
.day.today .num { background: var(--alm-today); color: var(--alm-today-ink); font-weight: 700; }
.chips { display: grid; gap: 2px; min-width: 0; }
.dots { display: none; }
.day-list { display: none; }
.day-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.day-list-head h3 { margin: 0; font-size: 22px; }

/* Rows (day list, agenda, trash) */
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.row-btn { width: 100%; display: flex; align-items: stretch; gap: 10px; padding: 8px 12px; min-height: 52px; border-radius: 14px; border-left-width: 5px; }
.row-btn .bar { display: none; }
.row-main, .trash-main { display: grid; gap: 1px; min-width: 0; align-content: center; }
.row-title { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.row-sub { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 13.5px; color: var(--ui-text-soft); }
.agenda { display: grid; gap: 16px; }
.agenda-day { display: grid; gap: 8px; }
.agenda-day h3 { margin: 0; font-size: 22px; }
.agenda-day.today h3::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 10px; border-radius: 50%; background: var(--alm-today); vertical-align: middle; }

/* Week and day grids */
.tg-scroll { position: relative; overflow: auto; border-radius: 18px; background: var(--alm-cell); box-shadow: inset 0 0 0 1px var(--alm-line); }
.tg-row { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); min-width: 0; }
.tg-top { position: sticky; top: 0; z-index: 3; background: var(--alm-pane-solid); box-shadow: 0 1px 0 var(--alm-line); }
.tg-gutter { font-size: 12px; color: var(--ui-text-soft); position: relative; }
.tg-allday .tg-gutter { display: grid; align-items: center; padding-left: 6px; }
.tg-gutter.hours span { position: absolute; right: 8px; transform: translateY(-50%); white-space: nowrap; }
.tg-day { border-left: 1px solid var(--alm-line); padding: 4px 2px; display: grid; justify-items: center; min-width: 0; }
.tg-daybtn { display: grid; justify-items: center; gap: 0; padding: 4px 10px; border-radius: 14px; text-align: center; min-width: 44px; min-height: 44px; }
.tg-daybtn .wd { font: 700 12px/1.2 var(--font-label); letter-spacing: .08em; text-transform: uppercase; color: var(--ui-label); }
.tg-daybtn .dn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; font-size: 18px; font-weight: 600; font-variant-numeric: lining-nums tabular-nums; }
.tg-day.today .dn { background: var(--alm-today); color: var(--alm-today-ink); }
.tg-cell { border-left: 1px solid var(--alm-line); padding: 4px 3px; display: grid; gap: 2px; align-content: start; min-width: 0; min-height: 30px; }
.tg-col { position: relative; border-left: 1px solid var(--alm-line); min-width: 0; cursor: cell; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 47px, var(--alm-line) 47px, var(--alm-line) 48px); }
.tg-col.today { background-color: color-mix(in srgb, var(--alm-today) 8%, transparent); }
.ev { position: absolute; box-sizing: border-box; display: flex; flex-direction: column; gap: 0; padding: 2px 6px; font-size: 12.5px; line-height: 1.25; overflow: hidden; border-radius: 8px; z-index: 1; }
.ev.short { flex-direction: row; align-items: baseline; gap: 6px; padding-block: 1px; }
.ev.short .title { white-space: nowrap; }
.ev.short .when { flex: none; }
.ev .title { min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.ev .when { font-size: 11.5px; opacity: .85; font-variant-numeric: tabular-nums; }
.now { position: absolute; left: 0; right: 0; height: 2px; background: var(--ui-warn, #e0533f); z-index: 2; pointer-events: none; }
.now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: inherit; }

/* Sheets */
dialog.sheet { width: min(580px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); margin: auto; padding: 22px 24px; border: 1px solid var(--alm-line-strong); border-radius: var(--radius-sheet); overflow-y: auto; color: var(--ui-text); background: var(--alm-pane-solid); }
dialog.sheet[open] { display: flex; flex-direction: column; }
.sheet-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; overflow-x: hidden; touch-action: pan-y; overscroll-behavior: contain; padding: 24px; border-radius: inherit; }
dialog.sheet.narrow { width: min(460px, calc(100vw - 24px)); }
dialog.sheet::backdrop { background: rgb(5 8 20 / .6); }
.sheet-title { margin: 0 0 14px; font: 600 28px/1.1 var(--font-display); letter-spacing: 0; color: var(--ui-title); }
.sheet label { display: block; margin: 0 0 12px; }
.sheet label > span:first-child, .field-label { display: block; margin-bottom: 4px; font-size: 13.5px; font-weight: 600; color: var(--ui-text-soft); }
.sheet :is(input:not([type="checkbox"], [type="color"]), select, textarea) { margin: 0; width: 100%; min-height: 44px; }
.sheet textarea { resize: vertical; }
.sheet select { appearance: none; padding-right: 44px; background-image: var(--alm-chevron); background-repeat: no-repeat; background-position: right 16px center; background-size: 16px; text-overflow: ellipsis; }
.sheet input[hidden] { display: none; }
.sheet label.check { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.sheet label.check input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--ui-accent); }
.sheet label.check span { margin: 0; font-size: 16px; color: var(--ui-text); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.repeat-box { display: grid; gap: 10px; margin: -2px 0 12px; padding: 12px; border-radius: 18px; background: var(--alm-cell); box-shadow: inset 0 0 0 1px var(--alm-line); }
.repeat-box label { margin: 0; }
.every { display: flex; align-items: center; gap: 10px; }
.every input { width: 84px !important; text-align: center; }
.weekdays { display: flex; flex-wrap: wrap; gap: 6px; }
.wd-chip { position: relative; margin: 0 !important; }
.wd-chip input { position: absolute; opacity: 0; inset: 0; width: 100% !important; height: 100%; min-height: 0 !important; margin: 0; cursor: pointer; }
.wd-chip span { display: grid; place-items: center; min-width: 46px; min-height: 40px; margin: 0 !important; padding: 0 10px; border-radius: var(--radius-control); background: var(--lg-control); box-shadow: var(--lg-control-rim); font-size: 14px !important; font-weight: 600; color: var(--ui-text) !important; }
.wd-chip input:checked + span { background: var(--button-main); color: var(--button-main-ink) !important; box-shadow: var(--button-main-rim); }
.wd-chip input:focus-visible + span { outline: 2px solid var(--ui-highlight); outline-offset: 2px; }
.ends { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 10px; }
/* A sheet's buttons: the main one with its word takes the room, the others are round symbols (a destructive one keeps its word) */
.sheet-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.sheet-actions.tools { margin: 0 0 12px; }
.sheet-actions .tools-note { flex: 1 0 100%; margin: 0; }
.sheet-actions.end { justify-content: flex-end; }
.sheet-actions button { min-height: 44px; }
.sheet-actions > button.primary.sym-word { flex: 1 1 auto; }
.sheet-actions > button.sym-word { padding-inline: 16px 20px; }
/* Questions keep worded answers side by side (or stacked when there are three) */
.ask-text { margin: 0 0 6px; white-space: pre-line; }
#ask-actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
#ask-actions.stack { grid-auto-flow: row; }
#ask-actions button { width: 100%; white-space: normal; line-height: 1.15; }
.field { margin-bottom: 12px; }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-bottom: 8px; }
.swatch { width: 100%; max-width: 40px; aspect-ratio: 1; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 2px rgb(255 255 255 / .35); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ui-highlight), inset 0 0 0 2px #fff; }
.custom-color { display: flex !important; align-items: center; gap: 12px; margin: 0 !important; }
.custom-color > span { margin: 0 !important; }
.custom-color input { width: 56px !important; min-height: 40px !important; padding: 0; border: 0; border-radius: 12px; background: none; cursor: pointer; }
.trash-list { list-style: none; margin: 0 0 4px; padding: 0; display: grid; gap: 8px; max-height: 50vh; overflow: auto; }
.trash-row { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; border-radius: 16px; background: var(--alm-cell); box-shadow: inset 0 0 0 1px var(--alm-line); min-height: 56px; }
.trash-main { flex: 1; }
.trash-row button { flex: none; min-height: 44px; padding: 8px 18px; }

/* Share and space sheets */
.sheet-sub { margin: 14px 0 8px; font: 700 12px/1.2 var(--font-label); letter-spacing: .1em; text-transform: uppercase; color: var(--ui-label); }
.member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.member-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; min-height: 56px; border-radius: 16px; background: var(--alm-cell); box-shadow: inset 0 0 0 1px var(--alm-line); }
.member-row > .role-badge { grid-column: 2 / 4; justify-self: end; margin-right: 8px; }
.member-main { display: grid; min-width: 0; }
.member-name { font-weight: 600; overflow-wrap: anywhere; }
.member-row :is(select, button) { min-height: 44px; margin: 0; }
.member-row select { appearance: none; width: 100%; padding-inline: 14px 40px; background-image: var(--alm-chevron); background-repeat: no-repeat; background-position: right 14px center; background-size: 16px; }
.member-row button { padding: 8px 14px; }
.invite-form { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 8px; align-items: stretch; }
.invite-form :is(input, select, button) { min-height: 44px; margin: 0; width: 100%; }
.invite-form select { appearance: none; padding-right: 40px; background-image: var(--alm-chevron); background-repeat: no-repeat; background-position: right 14px center; background-size: 16px; }
.invite-form button { width: auto; padding: 8px 18px; }
#share-host .muted[role="status"], #space-host .muted[role="status"] { margin-top: 8px; }
#share-host .message, #space-host .message { margin-top: 8px; }
.role-help { margin: 14px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; font-size: 14px; }
.role-help dt { font-weight: 700; }
.role-help dd { margin: 0; color: var(--ui-text-soft); }
#space-host { margin-bottom: 4px; }
.inv-actions { display: flex; gap: 8px; flex: none; }
.inv-actions button { min-height: 44px; padding: 8px 16px; }
.inv-row .row-sub { align-items: center; }
.sheet .notice { margin-bottom: 12px; }
.sheet input:disabled, .sheet select:disabled, .sheet textarea:disabled { opacity: .75; cursor: default; }

/* Synced calendars and the add sheet */
.synced-badge { background: color-mix(in srgb, var(--ui-highlight, #e9b84f) 28%, var(--alm-role-bg)); }
.sync-dot { flex: none; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--alm-ok); box-shadow: 0 0 0 2px rgb(255 255 255 / .25); }
.sync-dot.s-error { background: var(--alm-bad); }
.sync-dot.s-paused { background: var(--alm-pause); }
.source-box { margin: 0 0 12px; padding: 4px 14px 14px; border-radius: 18px; background: var(--alm-cell); box-shadow: inset 0 0 0 1px var(--alm-line); }
.source-box .sheet-sub { margin-top: 12px; }
.source-box .muted, .source-box .message { margin: 6px 0 0; }
.source-box .message { color: var(--ui-text); }
.source-box .sheet-actions { margin-top: 12px; }
.source-status { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.src-lead { margin-bottom: 12px; }

/* Provider plates: dark rounded squares with a gold hairline and an engraved cream glyph (one gold detail). Same in night and day. */
.plate { flex: none; display: grid; place-items: center; width: 48px; height: 48px; padding: 7px; box-sizing: border-box; border-radius: 30%;
  background: linear-gradient(160deg, #101a3a, #080c1e); box-shadow: inset 0 0 0 1px rgb(233 184 79 / .45), inset 0 1px 0 rgb(255 255 255 / .08), 0 2px 6px rgb(0 0 0 / .25); color: #f6e7bd; }
.plate svg { display: block; }
.plate .au { stroke: #e9b84f; }
.plate .dotf { fill: #e9b84f; stroke: none; }
.plate .mono { fill: currentColor; stroke: none; font: 400 19px/1 var(--font-label); letter-spacing: 0; }
.plate.small { width: 40px; height: 40px; padding: 6px; }

/* The Add dialog */
dialog.add-sheet { width: min(620px, calc(100vw - 24px)); }
.add-row, .tile { appearance: none; margin: 0; border: 0; color: var(--ui-text); font: inherit; letter-spacing: 0; text-transform: none; cursor: pointer; transform: none;
  background: var(--alm-cell); box-shadow: inset 0 0 0 1px var(--alm-line); white-space: normal; }
.add-row:hover:not(:disabled), .tile:hover:not(.off) { background: var(--alm-cell-hover); box-shadow: inset 0 0 0 1px var(--alm-line); }
.add-row:active:not(:disabled), .tile:active:not(.off) { background: var(--alm-cell-hover); }
.add-row:focus-visible, .tile:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ui-highlight); }
.add-row { width: 100%; display: flex; align-items: center; justify-content: flex-start; gap: 14px; padding: 12px 16px; min-height: 72px; border-radius: 22px; text-align: left; }
.add-row-text { display: grid; gap: 2px; min-width: 0; }
.add-row-text strong { font: 600 17px/1.2 var(--font-body); color: var(--ui-text); }
.add-row-text span, .tile-sub { font-size: 13.5px; line-height: 1.3; color: var(--ui-text-soft); }
#add-home .sheet-sub { margin-top: 18px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 10px; }
.tile { display: grid; grid-template-rows: auto auto 1fr; justify-items: center; align-content: start; gap: 6px; min-width: 0; min-height: 138px; padding: 16px 10px 14px; border-radius: 22px; text-align: center; }
.tile-name { font: 600 16.5px/1.2 var(--font-body); color: var(--ui-text); overflow-wrap: anywhere; }
.tile-sub { overflow-wrap: anywhere; }
.tile.off { cursor: not-allowed; background: transparent; box-shadow: inset 0 0 0 1px var(--alm-line); }
.tile.off .plate { background: linear-gradient(160deg, #2a2d3a, #1a1c26); color: rgb(246 231 189 / .6); box-shadow: inset 0 0 0 1px rgb(233 184 79 / .2); }
.tile.off .plate .au { stroke: rgb(233 184 79 / .5); }
.tile.off .tile-sub { font-style: italic; }
#src-unavailable { margin: 12px 0 0; }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.step-head .sheet-title { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.help-card { margin: 0 0 14px; padding: 4px 16px 14px; border-radius: 20px; background: var(--alm-cell); box-shadow: inset 0 0 0 1px var(--alm-line); }
.help-card .sheet-sub { margin-top: 12px; }
.help-card ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.help-card li { line-height: 1.4; }
.help-card ol li::marker { color: var(--ui-label); font-weight: 700; }
.help-notes { margin: 12px 0 0; padding: 10px 0 0 18px; border-top: 1px solid var(--alm-line); display: grid; gap: 4px; font-size: 14.5px; color: var(--ui-text-soft); }
.found-name { display: grid; min-width: 0; }
.found-name small { font-size: 12.5px; color: var(--ui-text-soft); }
.found-row:has(input:disabled) { background: transparent; }
.hint { margin: -4px 0 12px; font-size: 14px; }
.sheet input[type="password"] { width: 100%; }
.pick { margin: 0 0 12px; padding: 0; border: 0; min-width: 0; }
.pick legend { padding: 0; margin-bottom: 6px; font-size: 13.5px; font-weight: 600; color: var(--ui-text-soft); }
.found-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 40vh; overflow: auto; }
.found-row { border-radius: 16px; background: var(--alm-cell); box-shadow: inset 0 0 0 1px var(--alm-line); padding: 0 14px; }
.sheet .found-row label.check { margin: 0; }
.found-row .check span { overflow-wrap: anywhere; min-width: 0; }
#src-status, #src-error { margin-top: 10px; }

/* Sending changes back (step 4): per-event marks, the switch, the confirm sheet and the "Changes waiting" sheet */
.ss-dot { flex: none; display: inline-block; width: 9px; height: 9px; box-sizing: border-box; border-radius: 50%; background: var(--alm-ok); vertical-align: middle; }
.ss-dot.ss-waiting { background: transparent; border: 2px solid currentColor; opacity: .85; }
.ss-dot.ss-conflict { background: var(--alm-pause); border-radius: 1px; transform: rotate(45deg) scale(.9); box-shadow: 0 0 0 1.5px var(--alm-chip-base); }
.ss-dot.ss-error { background: var(--alm-bad); border-radius: 2px; box-shadow: 0 0 0 1.5px var(--alm-chip-base); }
.ss-dot.ss-off { background: var(--ui-text-soft); opacity: .6; }
.chip .ss-dot { margin-left: auto; align-self: center; }
.ev .ss-dot { position: absolute; top: 4px; right: 4px; }
.ev:has(.ss-dot) .title { padding-right: 12px; }
.ss-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ui-text); white-space: nowrap; }
.row-sub .ss-chip { font-size: 13px; }
.sync-note { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; padding: 10px 10px 10px 16px; }
.sync-note[data-state="conflict"] { box-shadow: inset 0 0 0 1.5px var(--alm-pause); }
.sync-note[data-state="error"] { box-shadow: inset 0 0 0 1.5px var(--alm-bad); }
.sync-note-text { flex: 1 1 260px; display: grid; gap: 2px; min-width: 0; }
.sync-note button { flex: none; min-height: 44px; padding: 8px 18px; }
.wb-hint { margin-top: -8px; }
.synced-badge.two-way { background: color-mix(in srgb, var(--alm-ok) 30%, var(--alm-role-bg)); }

.wb-switch { appearance: none; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0; padding: 12px 14px 12px 16px; min-height: 64px;
  border: 0; border-radius: 18px; background: var(--alm-cell); box-shadow: inset 0 0 0 1px var(--alm-line); color: var(--ui-text); font: inherit; letter-spacing: 0; text-transform: none;
  text-align: left; white-space: normal; cursor: pointer; transform: none; }
.wb-switch:hover:not(:disabled) { background: var(--alm-cell-hover); box-shadow: inset 0 0 0 1px var(--alm-line); }
.wb-switch:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ui-highlight); }
.wb-switch-text { display: grid; gap: 2px; min-width: 0; }
.wb-switch-text strong { font: 600 16px/1.25 var(--font-body); overflow-wrap: anywhere; }
.wb-switch-text span { font-size: 13.5px; line-height: 1.3; color: var(--ui-text-soft); }
.wb-track { flex: none; position: relative; width: 52px; height: 30px; border-radius: var(--radius-control); background: var(--alm-role-bg); box-shadow: inset 0 0 0 1.5px var(--alm-line); transition: background .15s; }
.wb-knob { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--ui-text-soft); transition: transform .15s, background .15s; }
.wb-switch[aria-checked="true"] .wb-track { background: var(--button-main); box-shadow: var(--button-main-rim); }
.wb-switch[aria-checked="true"] .wb-knob { transform: translateX(22px); background: var(--button-main-ink); }
.wb-status { display: flex; align-items: flex-start; gap: 10px; margin: 12px 2px 0; }
.wb-status .ss-dot { width: 11px; height: 11px; margin-top: 6px; }
.wb-status-text { display: grid; gap: 1px; min-width: 0; }
.wb-status-text strong { font-weight: 700; }
.wb-status-text span { font-size: 14px; color: var(--ui-text-soft); }
.choices { grid-auto-columns: minmax(0, 1fr); }
.source-box .sheet-actions button, #ob-dialog .sheet-actions button, #wb-dialog .sheet-actions button { white-space: normal; line-height: 1.15; }
.wb-status.s-saved .ss-dot { background: var(--alm-ok); }

.wb-sheet .step-head { align-items: flex-start; }
.wb-sheet .sheet-title { font-size: 26px; overflow-wrap: anywhere; }
.wb-lead { margin: 0 0 10px; font-weight: 600; }
.wb-points { margin: 0 0 14px; padding: 12px 16px 12px 34px; display: grid; gap: 8px; border-radius: 18px; background: var(--alm-cell); box-shadow: inset 0 0 0 1px var(--alm-line); line-height: 1.4; }
.wb-points li::marker { color: var(--ui-label); }
.wb-points li.strong { font-weight: 700; }
.sheet label.check.wb-ack { align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 16px; box-shadow: inset 0 0 0 1.5px var(--ui-highlight); margin-bottom: 4px; }
.sheet label.check.wb-ack input { margin-top: 1px; }
.sheet label.check.wb-ack span { font-weight: 600; line-height: 1.35; }
#wb-status, #wb-error { margin-top: 10px; }

.ob-list { list-style: none; margin: 0 0 4px; padding: 0; display: grid; gap: 10px; max-height: 58vh; overflow: auto; }
.ob-row { display: grid; gap: 6px; padding: 12px 14px; border-radius: 18px; background: var(--alm-cell); box-shadow: inset 0 0 0 1px var(--alm-line); outline: none; }
.ob-row:focus-visible { box-shadow: inset 0 0 0 2px var(--ui-highlight); }
.ob-row.ob-conflict { box-shadow: inset 0 0 0 1.5px var(--alm-pause); }
.ob-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; min-width: 0; }
.ob-title { flex: 1 1 160px; min-width: 0; font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.op-badge { flex: none; padding: 1px 9px; border-radius: var(--radius-control); background: var(--alm-role-bg); font-size: 12px; font-weight: 700; line-height: 1.5; text-transform: uppercase; letter-spacing: .06em; }
.op-badge.op-delete { background: color-mix(in srgb, var(--alm-bad) 26%, var(--alm-role-bg)); }
.ob-sub { margin: 0; }
.ob-explain { margin: 2px 0 0; }
.ob-versions { margin: 2px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ob-versions > div { padding: 8px 12px; border-radius: 14px; background: var(--alm-cell); box-shadow: inset 0 0 0 1px var(--alm-line); min-width: 0; }
.ob-versions dt { font: 700 11.5px/1.3 var(--font-label); letter-spacing: .08em; text-transform: uppercase; color: var(--ui-label); }
.ob-versions dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.choices { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin-top: 4px; }
.choices .choice { display: grid; align-content: center; justify-content: stretch; justify-items: start; gap: 3px; width: 100%; min-height: 64px; padding: 10px 16px; border-radius: 18px; text-align: left; white-space: normal; }
.choices .choice, .choices .choice * { font-family: var(--font-body); font-variant: normal; letter-spacing: 0; text-transform: none; }
.choices .choice strong { font-size: 15.5px; font-weight: 700; line-height: 1.25; }
.choices .choice span { font-size: 13.5px; line-height: 1.3; font-weight: 500; opacity: .85; }
#ob-title:focus { outline: none; }
#ob-title:focus-visible { outline: 2px solid var(--ui-highlight); outline-offset: 4px; border-radius: 6px; }
@media (max-width: 700px) {
  .ob-versions, .choices { grid-template-columns: 1fr; grid-auto-flow: row; }
  .sync-note button { flex: 1 0 100%; }
  .wb-switch { padding: 12px; }
  .wb-sheet .sheet-title { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) { .wb-track, .wb-knob { transition: none; } }

/* A pane of middle width: the period title gets its own line */
@container alm-pane (max-width: 860px) {
  .range-title { order: -1; flex-basis: 100%; }
  #new-event { margin-left: auto; }
}
/* A narrow pane (phones, tablets with the side list open): dots and a day list in the month, 44px targets, sticky hour gutter */
@container alm-pane (max-width: 600px) {
  .toolbar { gap: 8px; }
  .nav-group { gap: 4px; }
  .view-switch { margin-left: auto; }
  .view-switch button { --button: 44px; min-height: 44px; }
  .range-title { font-size: 24px; }
  .month { gap: 4px; }
  .dow span { padding-left: 0; text-align: center; font-size: 11px; letter-spacing: .04em; }
  .weeks, .week-row { gap: 2px; }
  .day { min-height: 54px; padding: 2px; gap: 0; justify-items: center; align-content: start; border-radius: 10px; cursor: pointer; }
  .day .num { width: 30px; height: 30px; }
  .chips { display: none; }
  .dots { display: flex; gap: 3px; justify-content: center; min-height: 8px; padding-top: 1px; }
  .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px rgb(255 255 255 / .4); }
  .day-list { display: block; margin-top: 12px; padding: 14px; border-radius: 20px; background: var(--alm-cell); box-shadow: inset 0 0 0 1px var(--alm-line); }
  .day-list-head h3 { font-size: 20px; }
  .day-list-head button { min-height: 44px; }
  .cols-7 .tg-row { min-width: 600px; }
  .tg-row { grid-template-columns: 44px repeat(var(--cols), minmax(0, 1fr)); }
  .tg-row > .tg-gutter { position: sticky; left: 0; z-index: 2; background: var(--alm-pane-solid); }
  .ev.short .when { display: none; }
  .tg-daybtn { min-width: 0; padding: 4px 2px; }
}
/* Phones with the bottom bar: its round middle button is New event, so the toolbar's own one steps aside (still clickable for the bar) */
html.tabbar-page #new-event { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; opacity: 0; pointer-events: none; }
/* Phones and short screens: the side list is a sheet or drawer with little height; the month view already shows the days */
@media (max-width: 520px) and (min-height: 501px), (max-height: 560px) and (min-width: 521px) { .mini { display: none; } }
/* Phones on their side: lower month cells, so a week or two shows under the toolbar */
@media (max-height: 560px) and (min-width: 521px) { .day { min-height: 84px; } }
/* Touch: 44px rows and buttons in the side list */
@media (max-width: 760px), (max-height: 560px) and (min-width: 521px), (pointer: coarse) {
  .cal-toggle, .space-head { min-height: 44px; }
  #sidebar .icon-btn.small { --button: 44px; min-height: 44px !important; height: 44px; }
  #sidebar .side-foot button { height: 44px; }
}
/* Sheets on small screens */
@media (max-width: 700px) {
  .repeat-box { padding: 8px; }
  .weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
  .wd-chip span { min-width: 0; padding: 0; }
  dialog.sheet { width: calc(100vw - 16px); }
  .sheet-scroll { padding: 18px 16px; }
  .pair { grid-template-columns: 1fr; }
  #ask-actions { grid-auto-flow: row; }
  .swatches { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .swatch { max-width: 44px; min-height: 44px; }
  .wd-chip span { min-height: 44px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { min-height: 128px; padding: 14px 8px 12px; }
  .add-row { min-height: 68px; padding: 10px 14px; }
  .help-card { padding: 2px 14px 12px; }
  /* rows with two buttons: the buttons move under a long name instead of squeezing it */
  .inv-row { flex-wrap: wrap; }
  .inv-row .trash-main { flex: 1 1 170px; }
  .inv-actions { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; max-width: 100%; }
  /* a destructive button that wraps under Save fills its line */
  .sheet-actions > button.danger.sym-word { flex: 1 1 auto; }
  .member-row { grid-template-columns: minmax(0, 1fr) auto; padding: 8px; }
  .member-main { grid-column: 1 / 3; padding: 2px 6px 0; }
  .member-row > .role-badge { grid-column: 2; grid-row: 1; }
  .member-row.creator { grid-template-columns: minmax(0, 1fr) auto; }
  .member-row.creator .member-main { grid-column: auto; }
  .member-row.creator > .role-badge { grid-column: auto; grid-row: auto; margin-right: 6px; }
  .invite-form { grid-template-columns: 1fr; }
  .invite-form button { width: 100%; }
  .role-help { grid-template-columns: 1fr; gap: 0; }
  .role-help dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { :is(.chip, .ev, .row-btn, .mini-day) { transition: none; } }

/* mail reminders in the event dialog */
.reminder-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.reminder-chip { min-height: 40px; padding: 0 14px; border: 0; border-radius: var(--radius-control); background: var(--lg-control); box-shadow: var(--lg-control-rim); color: var(--ui-text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.reminder-chip.on { background: var(--button-main); color: var(--button-main-ink); box-shadow: var(--button-main-rim); }
.reminder-chip:focus-visible { outline: 2px solid var(--ui-highlight); outline-offset: 2px; }
.reminder-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.reminder-custom > span { font-size: 14px; color: var(--ui-text-soft); }
.sheet .reminder-custom :is(input, select) { width: auto; flex: 1 1 90px; }
.reminder-row p { margin: 6px 0 0; }

/* ---- Living Window frame: the day list as a bottom sheet on phones (almanack-daysheet.js), events side by side without overlap ---- */
.ev.narrow .when { display: none; }
.lw-daysheet {
  position: fixed; z-index: 30; left: 8px; right: 8px; display: flex; flex-direction: column; box-sizing: border-box; overflow: hidden;
  border-radius: 24px 24px 18px 18px; background: rgb(var(--lg-ink, 16 16 20) / .98); color: var(--ui-text, #fff);
  box-shadow: var(--lg-shadow, 0 10px 30px rgb(0 0 0 / .4)), inset 0 1px 0 rgb(255 255 255 / .18);
}
.lw-daysheet .ds-handle { flex: none; display: grid; place-items: center; width: 100%; min-height: 44px; margin: 0; padding: 0; border: 0; border-radius: 24px 24px 0 0; background: none; box-shadow: none; touch-action: none; cursor: grab; }
.lw-daysheet .ds-handle span { width: 44px; height: 5px; border-radius: 3px; background: rgb(255 255 255 / .45); }
.lw-daysheet .ds-body { flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; padding: 0 14px 14px; }
.lw-daysheet .day-list { display: block; margin: 0; padding: 0; background: none; box-shadow: none; border-radius: 0; }
.lw-daysheet .day-list-head { touch-action: none; margin-bottom: 4px; }
.lw-daysheet .day-list-head h3 { font: 600 20px/1.2 var(--font-heading, serif); }
.lw-daysheet .rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lw-daysheet .row-btn { min-height: 52px; width: 100%; }
/* the month leaves room for the sheet at its peek height */
html.ds-on #stage { padding-bottom: var(--ds-peek, 0); }
:root:not([data-theme="dark"]) .lw-daysheet .ds-handle span { background: rgb(0 0 0 / .32); }

.dt { display: flex; gap: 6px; }
.dt[hidden] { display: none; }
.dt input[type="date"] { flex: 1 1 auto; min-width: 0; }
.dt input[type="text"] { flex: 0 0 5.5em; text-align: center; font-variant-numeric: tabular-nums; }
