:root {
  --ink: #1c1915;
  --muted: #6f675c;
  --line: rgba(28, 25, 21, 0.08);
  --paper: #f6f4f0;
  --green: #1c6b45;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: Outfit, "Segoe UI", sans-serif;
  font-size: 15px;
}

button, input, a { font: inherit; }

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.bar {
  position: relative;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.month-nav, .templates, .bar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.templates { flex: 0 1 auto; flex-wrap: nowrap; }
.template-tools { display: flex; align-items: center; gap: 8px; }
body.is-shift-drag.is-over-bin .month-view,
body.is-note-drag.is-over-bin .month-view { background: #f8e4e8; }
body.is-over-bin .shift-ghost,
body.is-over-bin .note-ghost { opacity: 0.15; }
.side-legend {
  flex: none;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 22px 0 0 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.side-legend p {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.swatch {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
}
.swatch-r { background: #f8ecd0; color: #7a5b12; }
.swatch-m { background: #d9f0e6; color: #0f6e56; }
.swatch-o { background: #dce8f8; color: #1d4e89; }
.swatch-x { background: #fff; color: #6b4c9a; box-shadow: inset 0 0 0 1px #b7a4d4; }
.bar-end {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
}
.bar-tail {
  display: flex;
  align-items: center;
  gap: 8px;
}
.more-menu { position: relative; }
.more-toggle {
  display: grid;
  gap: 3px;
  place-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #e4ddd2;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.more-toggle span {
  display: block;
  width: 14px;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
}
.more-toggle:hover,
.more-toggle[aria-expanded="true"] { background: #f7f4ef; }
.more-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 6;
  min-width: 180px;
  padding: 6px;
  border: 1px solid #e4ddd2;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 40px -24px rgba(40, 30, 20, 0.55);
}
.more-panel button,
.more-panel a {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  padding: 8px 12px;
  font-weight: 650;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.more-panel button:hover,
.more-panel a:hover { background: #f7f4ef; }
.more-panel a.is-on {
  background: #f4faf6;
  color: var(--green);
}
.hint-toggle {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.hint-toggle:hover { background: #f7f4ef; color: var(--ink); }
#clear-draft:hover:not(:disabled) { background: #fdf2f4; color: #be123c; }
#revert-draft:disabled,
#revert-draft:disabled:hover,
#clear-draft:disabled,
#clear-draft:disabled:hover {
  opacity: 0.35;
  background: transparent;
  color: var(--muted);
  cursor: default;
}
.role-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid #e4ddd2;
  border-radius: 999px;
  background: #f6f3ee;
}
.role-switch button,
.role-switch select {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 5px 12px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.role-switch button.is-on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(28, 25, 21, 0.08);
}
.role-switch select { max-width: 9rem; }

.month-nav > button,
#month-title,
.template,
#requests-toggle,
.back-link {
  border: 1px solid #e4ddd2;
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  text-decoration: none;
}

.month-nav > button { min-width: 36px; }
.month-pick { position: relative; }
#month-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 700;
  min-width: 9.5rem;
}
#month-title::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.45;
}
.month-picker {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 6;
  width: 276px;
  padding: 12px;
  border: 1px solid #e4ddd2;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 40px -24px rgba(40, 30, 20, 0.55);
}
.picker-year {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.picker-year strong { font-weight: 700; }
.picker-year button,
.picker-today {
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.picker-year button {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 18px;
  line-height: 1;
}
.picker-year button:hover,
.picker-today:hover { background: #f7f4ef; }
.picker-months {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.picker-month {
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.picker-month:hover { background: #f7f4ef; }
.picker-month.is-today:not(.is-on) {
  color: var(--green);
  box-shadow: inset 0 0 0 1px #b7d7c4;
}
.picker-month.is-on,
.picker-month.is-on:hover {
  background: var(--green);
  color: #fff;
}
.picker-today {
  width: 100%;
  margin-top: 8px;
  border-radius: 10px;
  padding: 7px 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.month-nav > button:hover,
#month-title:hover,
.template:hover,
#requests-toggle:hover,
.back-link:hover { background: #f7f4ef; }

.view-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid #e4ddd2;
  border-radius: 999px;
  background: #f6f3ee;
}
.view-switch button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 5px 12px;
  font-weight: 650;
  cursor: pointer;
}
.view-switch button.is-on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(28, 25, 21, 0.08);
}
.view-switch button.has-pending::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: #c4a15a;
  vertical-align: 1px;
}
body.is-published-view .template-tools { opacity: 0.4; pointer-events: none; }
body.is-published-view .cell,
body.is-published-view .chip { cursor: default; }

.template { cursor: grab; font-weight: 650; }
.template[data-label="R"] { background: #f8ecd0; border-color: #ead7a4; color: #7a5b12; }
.template[data-label="O"] { background: #dce8f8; border-color: #c5d7ef; color: #1d4e89; }
.template[data-label="M"] { background: #d9f0e6; border-color: #c3e4d4; color: #0f6e56; }
.template[data-label="X"] { background: #fff; border-style: dashed; border-color: #b7a4d4; color: #6b4c9a; }
.template.is-armed { box-shadow: inset 0 0 0 1.5px var(--ink); }
.stamp {
  position: fixed;
  z-index: 80;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid #ead7a4;
  border-radius: 999px;
  background: #f8ecd0;
  color: #7a5b12;
  font-size: 13px;
  font-weight: 750;
  line-height: 1;
  box-shadow: 0 10px 24px -16px rgba(60, 40, 20, 0.9);
  pointer-events: none;
}
.stamp[data-label="M"] { background: #d9f0e6; border-color: #c3e4d4; color: #0f6e56; }
.stamp[data-label="O"] { background: #dce8f8; border-color: #c5d7ef; color: #1d4e89; }
.stamp[data-label="X"] { background: #fff; border-style: dashed; border-color: #b7a4d4; color: #6b4c9a; }
.stamp[data-label="Vlastní"] { background: #fff; border-color: #e4ddd2; color: var(--ink); font-size: 12px; }
body.is-stamping .cell { cursor: copy; }
#publish {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
#publish:hover { background: #145236; }

#hint-toggle.is-on {
  background: #f4faf6;
  border-color: #b7d7c4;
  color: var(--green);
}

#publish { font-weight: 700; padding: 7px 14px; cursor: pointer; }
#publish:disabled {
  background: #e7efe9;
  border-color: #e7efe9;
  color: #6d8a7a;
  cursor: default;
}

.back-link { font-weight: 650; }

.month-view {
  position: relative;
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  justify-content: safe center;
  padding: 22px 18px 32px;
  overflow-x: auto;
  transition: background 120ms ease;
}
.shift-bin {
  position: absolute;
  inset: 0;
  z-index: 0;
}
body.is-shift-drag .month-stage,
body.is-shift-drag .note-rail,
body.is-shift-drag .side-legend { pointer-events: none; }
body.is-shift-drag .sheet-frame,
body.is-shift-drag .sheet-frame * { pointer-events: auto; }

.month-stage {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  gap: 0;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  width: max-content;
  max-width: 100%;
  min-width: 0;
}

.note-rail {
  width: 0;
  flex: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.note-rail.has-notes {
  --note-join: 15px;
  width: calc(168px + var(--note-join) + 1px);
  margin-right: calc(-1 * (var(--note-join) + 1px));
  position: relative;
  z-index: 3;
  overflow: visible;
}
.note-rail-pad { flex: none; }
.note-rail-scroll {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.note-rail-list {
  position: relative;
  height: 0;
}
.note-slot {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  min-height: 0;
  margin: 0;
}
.day-note {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 0 10px 0 12px;
  border: 1px solid #e0d5c6;
  border-right: 0;
  border-radius: 12px 0 0 12px;
  background: #fff;
  color: #8a8175;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: grab;
}
.day-note:active { cursor: grabbing; }
.note-rail-list > .day-note {
  position: absolute;
  right: 0;
  width: max-content;
  max-width: 100%;
  z-index: 2;
  height: auto;
}
.day-note.is-band-top,
.day-note.is-band-bot { align-items: center; }
.day-note.is-band-top {
  z-index: 3;
  overflow: visible;
  border-bottom: 0;
  border-radius: 12px 0 0 0;
}
.day-note.is-band-top::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -12px;
  height: 12px;
  background: linear-gradient(to bottom, var(--note-bg, #fff), transparent);
  pointer-events: none;
}
.day-note.is-band-bot {
  z-index: 2;
  border-top: 0;
  border-radius: 0 0 0 12px;
}
.note-rail-list > .day-note.is-inset {
  z-index: 3;
  border-radius: 8px 0 0 8px;
}
.note-label {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.day-note.is-note-source { opacity: 0.35; }
body.is-note-drag .row.is-note-target .day,
body.is-note-drag .row.is-note-target .cell { background: #e7f6ee; }
.note-ghost { opacity: 0.55; }
.note-drag-ghost {
  position: fixed;
  z-index: 80;
  max-width: min(220px, 70vw);
  padding: 8px 12px;
  border: 1px solid var(--note-line, #e0d5c6);
  border-radius: 12px;
  background: var(--note-bg, #fff);
  color: var(--note-ink, #5c5348);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 14px 30px -18px rgba(40, 30, 20, 0.55);
  transform: translate(-50%, calc(-100% - 14px));
  pointer-events: none;
}
.note-drag-ghost.is-alert {
  border-color: #e08b98;
  background: var(--note-bg, #fff6f7);
  color: var(--note-ink, #9a3b4a);
}
.day-note.is-weekend { background: #f3f0ea; }
.day-note.is-alert {
  color: #9a3b4a;
  background: #fff6f7;
  border-color: #e08b98;
}
.day-note.is-alert.is-weekend { background: #fdf3f4; }
[data-color="amber"] { --note-bg: #fbf4e2; --note-line: #ead7a8; --note-ink: #8a6820; --note-dot: #e2b34d; }
[data-color="green"] { --note-bg: #e7f6ee; --note-line: #b7dcc8; --note-ink: #246b48; --note-dot: #3e9a6a; }
[data-color="blue"] { --note-bg: #e8f1fb; --note-line: #c5d6ee; --note-ink: #345a86; --note-dot: #5b86c4; }
[data-color="violet"] { --note-bg: #f3eef8; --note-line: #d5c6e6; --note-ink: #684888; --note-dot: #8d6bb5; }
[data-color="coral"] { --note-bg: #fdeee4; --note-line: #f0cbb6; --note-ink: #a15a32; --note-dot: #e08a55; }
[data-color="red"] { --note-bg: #fdecee; --note-line: #f0b7c0; --note-ink: #9a3040; --note-dot: #d6455a; }
.day-note[data-color],
.day-note[data-color].is-weekend,
.day-note[data-color].is-alert,
.day-note[data-color].is-alert.is-weekend {
  background: var(--note-bg);
  border-color: var(--note-line);
  color: var(--note-ink);
}
.row.is-note-split .day,
.row.is-note-split .cell { min-height: 56px; }
.day-note.is-draft,
.day.has-note.is-draft {
  outline: 1.5px dashed rgba(92, 74, 48, 0.55);
  outline-offset: -3px;
}

.sheet-frame {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  background: #fff;
  border: 1px solid #efe8de;
  border-radius: 28px;
  box-shadow: 0 30px 70px -46px rgba(60, 40, 20, 0.55);
  overflow: hidden;
}

.head-scroll { overflow: hidden; }
.body-scroll { flex: 1; min-height: 0; overflow: auto; }

.head,
.row {
  display: grid;
  grid-template-columns: 52px repeat(var(--cols), 108px);
  gap: 6px;
  width: max-content;
  padding: 0 14px;
}
.head { padding-top: 14px; padding-bottom: 4px; }
.row + .row { margin-top: 6px; }
.body { --span-gap: 6px; padding-bottom: 14px; }

.corner,
.day {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
}

.col-head {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-height: 58px;
  padding: 8px 10px;
  background: #fffcf9;
  border: 1px solid #efe8de;
  border-radius: 16px;
  cursor: grab;
}
.col-head:active { cursor: grabbing; }

.name,
.person-open {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}

.name { font-weight: 700; font-size: 16px; line-height: 1.15; }
.name:hover, .person-open:hover strong { text-decoration: underline; }

.col-hours { font-size: 12px; color: var(--muted); }
.col-hours.is-over, .person-stats strong.is-over { color: #9a3b4a; }
.col-hours.is-over .col-standby, .person-stats strong.is-over .col-standby { color: var(--muted); }

.day, .cell {
  min-height: 46px;
}

.day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.day:hover { background: #f7f4ef; }

.day strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.day.is-weekend { background: #f3f0ea; }
.day.has-note {
  align-items: center;
  justify-content: center;
  border: 1px solid #e0d5c6;
  border-left: 0;
  border-radius: 0 12px 12px 0;
  background: #fff;
}
.day.has-note.note-cap-top {
  border-bottom-width: 0;
  border-bottom-right-radius: 0;
}
.day.has-note.note-cap-bot {
  border-top-width: 0;
  border-top-right-radius: 0;
}
.day.has-note.note-cap-mid {
  border-top-width: 0;
  border-bottom-width: 0;
  border-radius: 0;
}
.day.has-note.note-cap-top::after,
.day.has-note.note-cap-mid::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: 0;
  right: -1px;
  top: 100%;
  height: calc(var(--span-gap, 6px) + 1px);
  background: inherit;
  border-right: 1px solid transparent;
  border-right-color: inherit;
  pointer-events: none;
}
.day.note-cap-top.is-draft,
.day.note-cap-mid.is-draft,
.day.note-cap-bot.is-draft {
  outline: none;
}
.day em, .person-day em {
  font-style: normal;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: #b7aea3;
}
.day.has-note:hover { background: #fff; }
.day.has-note.is-weekend,
.day.has-note.is-weekend:hover { background: #f3f0ea; }
.day.has-note.has-alert,
.day.has-note.has-alert:hover {
  border-color: #e08b98;
  background: #fff6f7;
}
.day.has-note.has-alert.is-weekend,
.day.has-note.has-alert.is-weekend:hover {
  border-color: #e08b98;
  background: #fdf3f4;
}
.day.has-note[data-color],
.day.has-note[data-color]:hover,
.day.has-note[data-color].is-weekend,
.day.has-note[data-color].is-weekend:hover,
.day.has-note[data-color].has-alert,
.day.has-note[data-color].has-alert:hover,
.day.has-note[data-color].has-alert.is-weekend,
.day.has-note[data-color].has-alert.is-weekend:hover,
.day.has-note[data-color].is-closed,
.day.has-note[data-color].is-closed:hover,
.day.has-note[data-color].is-closed.is-weekend {
  background: var(--note-bg);
  border-color: var(--note-line);
}
.day.has-note.note-split,
.day.has-note.note-split:hover,
.day.has-note.note-split.is-weekend,
.day.has-note.note-split.is-weekend:hover,
.day.has-note.note-split.is-closed,
.day.has-note.note-split.is-closed:hover,
.day.has-note.note-split.is-closed.is-weekend {
  border-style: solid;
  border-width: 1px 1px 1px 0;
  border-color: transparent;
  background-image:
    linear-gradient(to bottom, var(--a-bg) 0, var(--a-bg) 50%, var(--b-bg) calc(50% + 12px), var(--b-bg) 100%),
    linear-gradient(to bottom, var(--a-line) 0, var(--a-line) 50%, var(--b-line) calc(50% + 12px), var(--b-line) 100%);
  background-clip: padding-box, border-box;
  background-origin: border-box, border-box;
}
.day > :not(.note-inset) {
  position: relative;
  z-index: 1;
}
.note-inset {
  position: absolute;
  z-index: 0;
  left: 0;
  right: 3px;
  top: 4px;
  bottom: 4px;
  border: 1px solid var(--note-line, #e0d5c6);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: var(--note-bg, #fff);
  pointer-events: none;
}
.day.note-cap-top > .note-inset,
.day.has-note:not(.note-cap-top):not(.note-cap-mid):not(.note-cap-bot) > .note-inset {
  top: 3px;
}
.day.note-cap-bot > .note-inset,
.day.has-note:not(.note-cap-top):not(.note-cap-mid):not(.note-cap-bot) > .note-inset {
  bottom: 3px;
}
.note-inset.is-cap-top {
  bottom: calc(var(--span-gap, 6px) * -1);
  border-bottom: 0;
  border-bottom-right-radius: 0;
}
.note-inset.is-cap-mid {
  top: calc(var(--span-gap, 6px) * -1);
  bottom: calc(var(--span-gap, 6px) * -1);
  border-top: 0;
  border-bottom: 0;
  border-radius: 0;
}
.note-inset.is-cap-bot {
  top: calc(var(--span-gap, 6px) * -1);
  border-top: 0;
  border-top-right-radius: 0;
}
.day.has-note:has(.note-inset.is-cap-top)::after,
.day.has-note:has(.note-inset.is-cap-mid)::after {
  background: transparent;
}
.day.is-today strong {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
}

.cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 3px;
  background: #fbf8f4;
  border-radius: 12px;
  cursor: pointer;
}

.cell.is-weekend { background: #f4f0e8; }
.cell.is-closed,
.cell.is-closed.is-weekend,
.cell.is-closed:hover,
.cell.is-closed.is-soft-can,
.cell.is-closed.is-soft-cant,
.row.is-closed .cell {
  background: #fff;
  cursor: not-allowed;
}
.cell.is-closed .chip { cursor: grab; }
.day.is-closed,
.day.is-closed.is-weekend,
.day.is-closed:hover { background: #fff; }
.cell.is-today { box-shadow: inset 0 0 0 1.5px #cfe3d6; }
.cell.is-soft-can { background: #f4faf6; }
.cell.is-soft-cant { background: #fdf7f7; }
.cell:hover { background: #f3efe8; }
.cell.is-picked,
.cell.is-picked:hover {
  outline: 2px solid #1c6b45;
  outline-offset: -2px;
  background: #eef8f2;
}

.hint {
  max-width: 100%;
  color: #b7aea3;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hint.is-cant { color: #d3a8b0; }
.span-scribble {
  position: absolute;
  z-index: 6;
  top: 0;
  left: 50%;
  max-width: calc(100% - 16px);
  transform: translate(-50%, -50%);
  padding: 1px 4px;
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.body:has(> .row:first-child .span-scribble) { padding-top: 10px; }

.chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: #f3f0ea;
  color: var(--ink);
  font-weight: 700;
  line-height: 1;
  padding: 2px 6px;
  cursor: grab;
}
.chip-letter { font-size: 22px; font-weight: 700; }
.chip-time, .chip-dash { font-size: 11px; font-weight: 650; }
.chip-dash { opacity: 0.55; }
.chip[data-label="R"] { background: #f8ecd0; color: #7a5b12; }
.chip[data-label="O"] { background: #dce8f8; color: #1d4e89; }
.chip[data-label="M"] { background: #d9f0e6; color: #0f6e56; }
.chip[data-label="X"] {
  background: #fff;
  color: #6b4c9a;
  box-shadow: inset 0 0 0 1px #b7a4d4;
}
.chip.is-draft,
.removal {
  outline: 1.5px dashed rgba(92, 74, 48, 0.55);
  outline-offset: -4px;
}
.removal {
  display: block;
  width: 100%;
  min-height: 38px;
  border-radius: 10px;
  pointer-events: none;
}

.page {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 28px 20px 40px;
}

.page h1 { margin: 0 0 6px; font-size: 1.6rem; font-weight: 700; }
.lead { margin: 0 0 18px; max-width: 40rem; color: var(--muted); }

#view-people,
#view-settings {
  display: flex;
  flex-direction: column;
  align-items: center;
}
#view-people h1, #view-people .lead,
#view-settings h1, #view-settings .lead { text-align: center; }

.settings-card {
  width: min(460px, 100%);
  padding: 16px;
  border: 1px solid #efe8de;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 40px -32px rgba(40, 30, 20, 0.5);
}
.settings-line {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.settings-line input,
.settings-break input {
  width: 100%;
  border: 1px solid #e4ddd2;
  border-radius: 10px;
  padding: 8px 10px;
  background: #faf8f5;
  color: var(--ink);
}
.settings-line input.is-bad {
  border-color: #e3b3bc;
  background: #fff6f7;
}
.settings-count {
  min-width: 4.5rem;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-align: right;
  white-space: nowrap;
}
.settings-break {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.settings-break input { width: 64px; }
.col-standby { color: var(--muted); }

.person-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: min(760px, 100%);
  margin-bottom: 18px;
}
.person-form input {
  flex: 1 1 180px;
  border: 1px solid #e4ddd2;
  background: #fff;
  border-radius: 12px;
  padding: 9px 12px;
}
.person-remove {
  align-self: flex-start;
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: #a15a68;
  font-weight: 650;
  cursor: pointer;
  padding: 0;
}

.people-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  width: min(920px, 100%);
}

.person-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 112px;
  padding: 16px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #e4ddd2;
}
.person-open {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  cursor: grab;
}
.person-open:active { cursor: grabbing; }
.person-open strong { font-size: 1.32rem; line-height: 1.2; font-weight: 750; }
.person-open span { color: var(--muted); font-size: 14px; }
.person-actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
}
.person-actions button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--ink);
  font-weight: 650;
  cursor: pointer;
}
.person-actions .person-remove { margin: 0; color: #a15a68; }
.person-edit { display: flex; flex-direction: column; gap: 8px; }
.person-edit input {
  width: 100%;
  border: 1px solid #e4ddd2;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
}
.person-edit-actions { display: flex; gap: 8px; }

.profile {
  max-width: 760px;
  padding: 22px;
  border-radius: 18px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #efe8de;
  box-shadow: 0 16px 40px -32px rgba(40, 30, 20, 0.5);
}

.profile h1 { margin: 0; font-size: 1.8rem; }
.profile .email { margin: 4px 0 16px; color: var(--muted); }
.profile label { display: block; font-size: 12px; font-weight: 650; color: var(--muted); }
.profile input {
  width: 100%;
  margin: 6px 0 12px;
  padding: 8px 10px;
  border: 1px solid #e4ddd2;
  border-radius: 10px;
  background: #faf8f5;
}
.person-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.person-stats p {
  margin: 0;
  min-width: 140px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fbf8f4;
}
.person-stats strong { display: block; font-size: 1.35rem; }
.person-stats span { color: var(--muted); font-size: 13px; }
.person-month {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}
.person-month button {
  width: 32px;
  height: 32px;
  border: 1px solid #e4ddd2;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}
.person-cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.person-blank { min-height: 64px; }
.person-day {
  min-height: 64px;
  padding: 6px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #efe8de;
}
.person-day.is-weekend { background: #fbf8f4; }
.person-day.is-closed,
.person-day.is-closed.is-weekend { background: #fff; color: #b7aea3; }
.person-day.is-today { box-shadow: inset 0 0 0 1.5px #cfe3d6; }
.person-num { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.person-note {
  display: block;
  max-width: 100%;
  margin-top: 3px;
  overflow: hidden;
  color: var(--note-ink, #8a6820);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.person-note.is-alert { color: var(--note-ink, #9a3b4a); }
.person-day.has-note { cursor: pointer; }
.person-day.has-note { border-color: var(--note-line, #e2c48a); }
.person-day.note-split {
  background: linear-gradient(to bottom, var(--a-bg) 0%, var(--a-bg) 46%, var(--b-bg) 54%);
  border-color: var(--a-line);
}
.person-day.note-nest { outline: 1px solid var(--b-line, var(--note-line)); outline-offset: -5px; }
.person-day.has-alert { border-color: var(--note-line, #e7a3ae); }
.person-day.is-today.has-note,
.person-day.is-today.has-alert {
  box-shadow: inset 0 0 0 1.5px #cfe3d6;
}
.person-chip {
  min-height: 28px;
  cursor: default;
  pointer-events: none;
}
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#toggle-closed.is-on,
#set-day-closed.is-on {
  background: #1c6b45;
  border-color: #1c6b45;
  color: #fff;
}
.profile-actions a, .profile-actions button, .btn-ghost, .btn-solid, .btn-danger {
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
}
.profile-actions a, .btn-ghost {
  border: 1px solid #e4ddd2;
  background: #fff;
  color: var(--ink);
}
.btn-solid, .profile-actions .btn-solid {
  border: 0;
  background: var(--green);
  color: #fff;
  font-weight: 700;
}
.btn-danger { border: 0; background: transparent; color: #be123c; font-weight: 700; }
.note { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.empty-note { color: var(--muted); }

.plan-page {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  justify-content: center;
  padding: 28px 16px 48px;
}
.plan-card { width: min(920px, 100%); }
.plan-card h1 { margin: 0 0 6px; text-align: center; font-size: 1.8rem; }
.plan-card .lead { margin: 0 auto 18px; text-align: center; }
.plan-people {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
}
.plan-person {
  border: 1px solid #e7dfd4;
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 650;
}
.plan-person.is-on {
  border-color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--ink);
}
.plan-total {
  margin: -6px 0 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}
.plan-total strong { color: var(--ink); font-weight: 700; }
.plan-total strong.is-over { color: #9a3b4a; }
.plan-grid {
  --span-gap: 8px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--span-gap);
}
.span-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 14px;
}
.span-bar span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.span-hint {
  flex: 1 0 100%;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.3;
  text-align: center;
}
.span-limit {
  width: 52px;
  padding: 6px 12px;
  border: 1px solid #e4ddd2;
  border-radius: 999px;
  background: #fff;
  text-align: center;
}
.span-bar .btn-solid:disabled { opacity: 0.4; cursor: default; }
.plan-dow {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.dow-float { display: none; }
.day-tile, .day-blank {
  min-height: 118px;
  border-radius: 16px;
}
.day-blank { background: transparent; }
.day-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 10px;
  border: 1px solid #efe8de;
  background: #fff;
  text-align: left;
  cursor: pointer;
}
.day-tile.is-holding { box-shadow: inset 0 0 0 2px #1c6b45; }
.day-tile.is-weekend { background: #fbf8f4; }
.day-tile.is-today { box-shadow: inset 0 0 0 1.5px #cfe3d6; }
.day-tile.is-can { background: #f5fbf7; border-color: #d5eadc; }
.day-tile.is-cant { background: #fdf7f7; border-color: #f0d5da; }
.day-tile.is-closed,
.day-tile.is-closed.is-weekend,
.day-tile.is-closed.is-can,
.day-tile.is-closed.is-cant,
.day-tile.is-closed.is-today {
  background: #eceae6;
  border-color: #e0dbd4;
  color: #b7aea3;
  box-shadow: none;
  cursor: not-allowed;
}
.day-tile.is-closed .tile-num,
.day-tile.is-closed .tile-dow,
.day-tile.is-closed .tile-state,
.day-tile.is-closed .tile-brief,
.day-tile.is-closed .tile-mark,
.day-tile.is-closed .tile-extra,
.day-tile.is-closed .span-note {
  color: #b7aea3;
}
.day-tile.is-closed .tile-brief { display: flex; }
.day-tile.is-closed .span-note { cursor: default; }
.day-tile.is-closed.is-span::before { border-color: #d5d0c8; }
.day-tile.is-span,
.cell.is-span { position: relative; z-index: 1; }
.day-tile.is-span { border-color: transparent; }
.day-tile.is-span::before,
.cell.is-span::before {
  content: "";
  position: absolute;
  z-index: 2;
  pointer-events: none;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  border: 1.5px solid #7f947c;
  border-radius: var(--tile-radius, 16px);
}
.cell.is-span::before { border-radius: 12px; }
.day-tile.is-span-draft::before,
.cell.is-span-draft::before { border-style: dashed; border-color: #a3b39c; }
.day-tile.span-r::before,
.cell.span-r::before {
  right: calc(-1 * var(--span-gap) - 0.5px);
  border-right-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.day-tile.span-l::before,
.cell.span-l::before {
  border-left-width: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.day-tile.span-d::before,
.cell.span-d::before {
  bottom: calc(-1 * var(--span-gap) - 0.5px);
  border-bottom-width: 0;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}
.day-tile.span-u::before,
.cell.span-u::before {
  border-top-width: 0;
  border-top-right-radius: 0;
  border-top-left-radius: 0;
}
.span-note {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 12px;
  transform: translateY(-50%);
  max-width: 180px;
  padding: 0 4px;
  border: 0;
  background: var(--paper);
  color: #6e7b6a;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cell .span-note {
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: calc(100% - 8px);
  background: #fff;
  text-align: center;
  cursor: default;
}
.span-note.is-pending { color: #b7b1a6; font-weight: 600; }
.tile-fit,
.person-fit {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  min-width: 0;
}
.person-fit { gap: 0; }
.tile-num { font-size: 1.15rem; font-weight: 700; }
.tile-state { color: var(--muted); font-size: 12px; font-weight: 650; }
.tile-brief { display: none; }
.day-tile.is-cant .tile-state { color: #c48b96; }
.tile-codes { display: flex; gap: 4px; }
.code, .note-add, .tile-quiet {
  border: 1px solid #e7dfd4;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
}
.code, .note-add {
  width: 24px;
  height: 24px;
  font-size: 12px;
  font-weight: 700;
}
.code.is-on[data-code="R"] { background: #f8ecd0; border-color: #ead7a4; }
.code.is-on[data-code="M"] { background: #d9f0e6; border-color: #c3e4d4; }
.code.is-on[data-code="O"] { background: #dce8f8; border-color: #c5d7ef; }
.tile-note {
  width: 100%;
  border: 1px solid #e7dfd4;
  border-radius: 8px;
  padding: 4px 6px;
  background: #fff;
}
.tile-actions { display: flex; gap: 6px; }
.tile-quiet {
  padding: 3px 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  text-align: left;
}

.popover {
  position: fixed;
  z-index: 20;
  width: min(340px, calc(100vw - 16px));
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #e4ddd2;
  box-shadow: 0 18px 40px -24px rgba(40, 30, 20, 0.45);
}
.popover-title { margin: 0 0 8px; font-weight: 700; }
.note-view-text {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.35;
}
.note-view-text.is-empty { color: var(--muted); font-weight: 600; }
.note-view-text.is-alert { color: #9a3b4a; }
.note-view-text[data-color],
.note-view-text[data-color].is-alert { color: var(--note-ink); }
#note-view[data-color] {
  box-shadow: inset 4px 0 0 var(--note-dot), 0 18px 40px -24px rgba(40, 30, 20, 0.45);
}
.note-view-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #efe8de;
}
.note-view-row:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.note-view-row .btn-solid { flex: none; }
.note-view-detail {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.4;
  white-space: pre-wrap;
}
.note-detail-label { margin-top: 10px; }
.note-span {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.note-span .popover-label { margin-bottom: 4px; }
.note-span input { width: 100%; }
.note-color-label { margin: 10px 0 8px; }
.note-colors { display: flex; gap: 8px; margin: 0 0 14px; }
.note-swatch {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--note-dot, #fff);
  box-shadow: inset 0 0 0 1px rgba(28, 25, 21, 0.08);
  cursor: pointer;
}
.note-swatch.is-on {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--note-dot, #1c1915);
}
.note-swatch[data-color=""] {
  background:
    linear-gradient(135deg, transparent 45%, #c9bfb2 46%, #c9bfb2 54%, transparent 55%),
    #fff;
  box-shadow: inset 0 0 0 1.5px #d9d0c4;
}
.note-swatch[data-color=""].is-on {
  box-shadow: inset 0 0 0 1.5px #d9d0c4, 0 0 0 2px #fff, 0 0 0 4px #1c1915;
}
.note-swatch:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.note-detail {
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid #e4ddd2;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  resize: vertical;
}
.note-view .popover-actions { justify-content: flex-end; margin-top: 12px; }
.popover-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.popover-presets .template { cursor: pointer; }
.popover-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 650; }
.time-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e4ddd2;
  border-radius: 10px;
  font-size: 16px;
}
.popover-hint { margin: 8px 0 12px; color: var(--muted); font-size: 12px; }
.popover-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-choice {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.plan-choice button {
  flex: 1;
  min-height: 44px;
  border: 1px solid #e4ddd2;
  border-radius: 12px;
  background: #fff;
  font-weight: 650;
  cursor: pointer;
}
.plan-choice button.is-on[data-plan-status="can"] {
  background: #f5fbf7;
  border-color: #1c6b45;
  color: #145236;
}
.plan-choice button.is-on[data-plan-status="cant"] {
  background: #fdf7f7;
  border-color: #e08b98;
  color: #9a3b4a;
}
#plan-note-field { margin-bottom: 12px; }
#plan-codes { margin-bottom: 12px; }
#plan-codes .template { cursor: pointer; }

dialog { border: 0; padding: 0; background: transparent; }
dialog::backdrop { background: rgba(28, 25, 21, 0.28); }
.dialog-card {
  width: min(420px, calc(100vw - 24px));
  padding: 18px;
  border-radius: 16px;
  background: #fff;
}
.dialog-card h3 { margin: 0 0 8px; }
.dialog-card p { margin: 0; color: var(--muted); line-height: 1.45; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

#toasts {
  position: fixed;
  right: 14px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 30;
}
.toast {
  max-width: 320px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #1c1915;
  color: #fff;
  font-size: 14px;
}
.toast.is-error { background: #7f1d1d; }
.toast.is-leaving { opacity: 0; }

.col-ghost, .shift-ghost { opacity: 0.45; }
.shift-fallback, .col-fallback {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 24px -16px rgba(0, 0, 0, 0.4);
}
body.is-busy { cursor: progress; }
.noscript { padding: 24px; text-align: center; }

.day-inline-note,
.tabbar,
.tile-dow,
.person-dow { display: none; }

.tabbar a {
  flex: 1;
  border-radius: 12px;
  padding: 8px 4px;
  text-align: center;
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.tabbar a.is-on {
  background: #f4faf6;
  color: var(--green);
}

@media (max-width: 760px) {
  .bar {
    position: sticky;
    top: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: max(8px, env(safe-area-inset-top)) 12px 10px;
  }
  .bar:not(:has(#month-nav:not([hidden]))) { display: none; }
  .back-link { display: none !important; }
  .month-nav {
    width: 100%;
    justify-content: space-between;
    padding-right: 44px;
  }
  #month-title { flex: 1; min-width: 0; }
  .more-menu {
    position: absolute;
    top: max(6px, env(safe-area-inset-top));
    right: 10px;
    z-index: 8;
  }
  .month-picker { left: 50%; transform: translateX(-50%); }
  .template-tools {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .templates { width: max-content; }
  .template { flex: none; min-height: 40px; padding: 8px 14px; }
  .bar-end {
    margin-left: 0;
    width: 100%;
  }
  .bar-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .bar-tail { width: 100%; justify-content: flex-end; }
  .view-switch { flex: 1; }
  .view-switch button { flex: 1; min-height: 36px; }
  #publish { flex: 1 0 100%; min-height: 40px; }
  .stamp { display: none !important; }

  body {
    --col: 34px;
    --dayw: 20px;
    --rowh: 28px;
    --gap: 2px;
    --head: 32px;
  }
  body[data-zoom="1"] {
    --col: 54px;
    --dayw: 24px;
    --rowh: 42px;
    --gap: 4px;
    --head: 48px;
  }
  body[data-zoom="2"] {
    --col: 92px;
    --dayw: 26px;
    --rowh: 54px;
    --gap: 5px;
    --head: 68px;
  }
  body[data-zoom="3"] {
    --col: 150px;
    --dayw: 32px;
    --rowh: 78px;
    --gap: 6px;
    --head: 88px;
  }

  .month-view {
    padding: 6px 6px 0;
    padding-bottom: calc(52px + env(safe-area-inset-bottom));
  }
  .month-stage { width: 100%; }
  .note-rail,
  .side-legend { display: none !important; }
  .sheet-frame {
    flex: 1;
    width: 100%;
    min-width: 0;
    border-radius: 18px;
  }
  .body-scroll {
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
  }
  .head,
  .row {
    grid-template-columns: var(--dayw) repeat(var(--cols), var(--col));
    gap: var(--gap);
    padding: 0 8px 0 2px;
  }
  .head { padding-top: 8px; padding-bottom: 2px; }
  .row + .row { margin-top: var(--gap); }
  .body { padding-bottom: 16px; }
  .col-head {
    min-height: var(--head);
    padding: 6px 4px 6px;
    border-radius: 10px;
  }
  .col-head .name {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .day,
  .cell { min-height: var(--rowh); }
  .day,
  .cell {
    -webkit-touch-callout: none;
    user-select: none;
  }
  body.is-cell-hold .shift-fallback { opacity: 0; }
  body.is-note-drag .day.is-note-source { opacity: 0.35; }
  body.is-note-drag .row.is-note-target .day::before,
  body.is-note-drag .row.is-note-target .cell {
    background: #e7f6ee;
  }
  body.is-selecting #templates {
    border-radius: 14px;
    box-shadow: 0 0 0 1.5px #1c6b45;
  }
  .day,
  .day:hover,
  .day.is-weekend,
  .day.is-weekend:hover,
  .day.has-note,
  .day.has-note:hover,
  .day.has-note.is-weekend,
  .day.has-note.is-weekend:hover,
  .day.has-note.has-alert,
  .day.has-note.has-alert:hover,
  .day.has-note.has-alert.is-weekend,
  .day.has-note.has-alert.is-weekend:hover,
  .day.has-note[data-color],
  .day.has-note[data-color]:hover,
  .day.has-note[data-color].is-weekend,
  .day.has-note[data-color].is-weekend:hover,
  .day.has-note[data-color].has-alert,
  .day.has-note[data-color].has-alert:hover,
  .day.has-note[data-color].has-alert.is-weekend,
  .day.has-note[data-color].is-closed,
  .day.has-note[data-color].is-closed.is-weekend,
  .day.is-closed,
  .day.is-closed.is-weekend,
  .day.is-closed:hover,
  .day.has-note.is-draft {
    border: 0;
    border-radius: 0;
    outline: none;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }
  .day.has-note.note-cap-top::after,
  .day.has-note.note-cap-mid::after { content: none; }
  .day::before {
    content: "";
    position: absolute;
    z-index: 0;
    left: 0;
    right: 0;
    top: calc(var(--gap) * -0.5 - 1px);
    bottom: calc(var(--gap) * -0.5 - 1px);
    background: #fff;
    pointer-events: none;
  }
  .day > span,
  .day > strong,
  .day::after {
    position: relative;
    z-index: 1;
  }
  .day {
    gap: 1px;
    color: #c2b6aa;
    font-weight: 650;
    line-height: 1;
    letter-spacing: 0.02em;
  }
  .day strong {
    color: #3a342c;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
  }
  .day.is-weekend { color: #c9bfb4; }
  .day.is-weekend strong { color: #8f867c; }
  .day.has-note:not(.is-today) strong,
  .day.has-alert:not(.is-today) strong { color: var(--note-ink, #8a6820); }
  .day.has-alert:not(.is-today) strong { color: var(--note-ink, #9a3b4a); }
  .day em,
  .day-inline-note { display: none; }
  .head-scroll {
    position: relative;
    z-index: 3;
    background: #fff;
    box-shadow: 0 10px 16px -14px rgba(60, 40, 20, 0.55);
  }
  .corner {
    box-shadow: none;
  }
  .month-view .chip,
  .removal {
    min-height: calc(var(--rowh) - 6px);
    border-radius: 7px;
    padding: 0 2px;
  }
  .hint { font-size: 9px; }

  body[data-zoom="0"] .month-view .chip-letter { font-size: 16px; }
  body[data-zoom="0"] .name,
  body[data-zoom="0"] .day,
  body[data-zoom="0"] .day strong { font-size: 8px; }
  body[data-zoom="0"] .day.is-today strong { min-width: 14px; height: 14px; }
  body[data-zoom="0"] .day > span,
  body[data-zoom="0"] .day em,
  body[data-zoom="0"] .month-view .chip:has(.chip-letter) .chip-time,
  body[data-zoom="0"] .month-view .chip:has(.chip-letter) .chip-dash,
  body[data-zoom="0"] .col-hours,
  body[data-zoom="0"] .grip,
  body[data-zoom="1"] .month-view .chip:has(.chip-letter) .chip-time,
  body[data-zoom="1"] .month-view .chip:has(.chip-letter) .chip-dash,
  body[data-zoom="1"] .col-hours,
  body[data-zoom="1"] .grip,
  body[data-zoom="1"] .day em { display: none; }
  body[data-zoom="0"] .month-view .chip:not(:has(.chip-letter)) .chip-time,
  body[data-zoom="1"] .month-view .chip:not(:has(.chip-letter)) .chip-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    max-width: 100%;
    font-size: 8px;
    font-weight: 700;
    line-height: 1.05;
  }
  body[data-zoom="1"] .month-view .chip:not(:has(.chip-letter)) .chip-time { font-size: 10px; }
  body[data-zoom="0"] .month-view .chip:not(:has(.chip-letter)) .chip-sep,
  body[data-zoom="1"] .month-view .chip:not(:has(.chip-letter)) .chip-sep { display: none; }
  body[data-zoom="1"] .name { font-size: 11px; }
  body[data-zoom="1"] .day,
  body[data-zoom="1"] .day strong { font-size: 10px; }
  body[data-zoom="1"] .day.is-today strong { min-width: 16px; height: 16px; }
  body[data-zoom="1"] .month-view .chip-letter { font-size: 24px; }
  body[data-zoom="2"] .name { font-size: 14px; }
  body[data-zoom="2"] .day { font-size: 10px; }
  body[data-zoom="2"] .day strong { font-size: 12px; }
  body[data-zoom="2"] .day.is-today strong { min-width: 18px; height: 18px; }
  body[data-zoom="2"] .month-view .chip-letter { font-size: 32px; }
  body[data-zoom="2"] .month-view .chip-time { font-size: 13px; }
  body[data-zoom="2"] .grip { display: none; }
  #body .day.has-note::before,
  #body .day.has-alert::before {
    top: 2px;
    right: 1px;
    bottom: 2px;
    left: 1px;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1.5px var(--note-dot, #c4a15a);
  }
  #body .day.has-alert::before {
    box-shadow: inset 0 0 0 1.5px var(--note-dot, #c45b6a);
  }
  #body .day.has-note.is-draft::before,
  #body .day.has-alert.is-draft::before {
    box-shadow: none;
    border: 1.5px dashed var(--note-dot, #c4a15a);
  }
  .day.has-note::after,
  .day.has-alert::after {
    content: "";
    width: 12px;
    height: 2.5px;
    margin-top: 3px;
    border-radius: 99px;
    background: var(--note-dot, #c4a15a);
  }
  .day.has-alert::after { background: #c45b6a; }
  .day.has-note[data-color]::after,
  .day.has-alert[data-color]::after { background: var(--note-dot); }
  #body .day.has-note.note-cap-top::before,
  #body .day.has-note.note-cap-mid::before,
  #body .day.has-note.note-cap-bot::before,
  #body .day.has-alert.note-cap-top::before,
  #body .day.has-alert.note-cap-mid::before,
  #body .day.has-alert.note-cap-bot::before {
    left: 1px;
    right: 1px;
    border-radius: 0;
    box-shadow: none;
    background: var(--note-bg, #fff);
    border-style: solid;
    border-color: var(--note-dot, #c4a15a);
    border-width: 0 1.5px;
  }
  #body .day.has-alert.note-cap-top::before,
  #body .day.has-alert.note-cap-mid::before,
  #body .day.has-alert.note-cap-bot::before {
    border-color: var(--note-dot, #c45b6a);
  }
  #body .day.has-note.note-cap-top::before,
  #body .day.has-alert.note-cap-top::before {
    top: 2px;
    bottom: calc(var(--gap) * -0.5 - 1px);
    border-top-width: 1.5px;
    border-radius: 6px 6px 0 0;
  }
  #body .day.has-note.note-cap-mid::before,
  #body .day.has-alert.note-cap-mid::before {
    top: calc(var(--gap) * -0.5);
    bottom: calc(var(--gap) * -0.5 - 1px);
  }
  #body .day.has-note.note-cap-bot::before,
  #body .day.has-alert.note-cap-bot::before {
    top: calc(var(--gap) * -0.5);
    bottom: 2px;
    border-bottom-width: 1.5px;
    border-radius: 0 0 6px 6px;
  }
  #body .day.has-note.is-draft.note-cap-top::before,
  #body .day.has-note.is-draft.note-cap-mid::before,
  #body .day.has-note.is-draft.note-cap-bot::before,
  #body .day.has-alert.is-draft.note-cap-top::before,
  #body .day.has-alert.is-draft.note-cap-mid::before,
  #body .day.has-alert.is-draft.note-cap-bot::before {
    border-style: dashed;
  }
  #body .day.note-split,
  #body .day.note-split:hover,
  #body .day.note-split.is-weekend,
  #body .day.note-split.is-closed {
    background: transparent;
    background-image: none;
    border-color: transparent;
  }
  #body .day.note-split::before {
    background-image:
      linear-gradient(to bottom, var(--a-bg) 0, var(--a-bg) 50%, var(--b-bg) calc(50% + 12px), var(--b-bg) 100%),
      linear-gradient(to bottom, var(--a-line) 0, var(--a-line) 50%, var(--b-line) calc(50% + 12px), var(--b-line) 100%);
    background-clip: padding-box, border-box;
    background-origin: border-box, border-box;
    box-shadow: none;
    border-style: solid;
    border-width: 1.5px 1.5px 1.5px 0;
    border-color: transparent;
  }
  #body .day.note-split.is-draft::before { border-style: dashed; }
  .day.has-note.note-cap-top::after,
  .day.has-alert.note-cap-top::after {
    content: "";
    position: relative;
    z-index: 1;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    width: 12px;
    height: 2.5px;
    margin-top: 3px;
    border: 0;
    border-radius: 99px;
    background: var(--note-dot, #c4a15a);
    pointer-events: none;
  }
  .day.has-alert.note-cap-top::after { background: var(--note-dot, #c45b6a); }
  .day.has-note.note-cap-top[data-color]::after,
  .day.has-alert.note-cap-top[data-color]::after { background: var(--note-dot); }
  .day.has-note.note-cap-mid::after,
  .day.has-note.note-cap-bot::after,
  .day.has-alert.note-cap-mid::after,
  .day.has-alert.note-cap-bot::after { content: none; }
  body[data-zoom="3"] .day { font-size: 12px; }
  body[data-zoom="3"] .day strong { font-size: 15px; }
  body[data-zoom="3"] .name { font-size: 14px; white-space: normal; }
  body[data-zoom="3"] .month-view .chip { padding: 2px 6px; }
  body[data-zoom="3"] .month-view .chip-letter { font-size: 40px; }
  body[data-zoom="3"] .month-view .chip-time { font-size: 15px; }

  .tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    gap: 4px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(10px);
  }
  .page,
  .plan-page { padding: 16px 12px calc(88px + env(safe-area-inset-bottom)); }
  .page h1, .plan-card h1 { font-size: 1.4rem; }
  .person-form { flex-direction: column; align-items: stretch; }
  .person-form input { flex: 0 0 auto; width: 100%; min-height: 44px; }
  .person-form .btn-solid { min-height: 42px; }
  .profile { padding: 16px; }
  .profile h1 { font-size: 1.45rem; }
  .person-stats p { flex: 1; min-width: 0; }

  body[data-cal-zoom="0"] { --cal-scale: 1; --tile-radius: 12px; --cal-gap: 4px; }
  body[data-cal-zoom="1"] { --cal-scale: 1.38; --tile-radius: 14px; --cal-gap: 5px; }
  body[data-cal-zoom="2"] { --cal-scale: 1.9; --tile-radius: 16px; --cal-gap: 6px; }
  body[data-cal-zoom="3"] { --cal-scale: 2.55; --tile-radius: 18px; --cal-gap: 8px; }

  .plan-page {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 12px 12px calc(68px + env(safe-area-inset-bottom));
    touch-action: pan-x pan-y;
  }
  .plan-card {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
  }
  .plan-card .lead { display: none; }
  .plan-card h1 { margin-bottom: 10px; }
  .plan-people { margin-bottom: 10px; }
  .plan-total { margin: 0 0 10px; }
  #plan-board,
  .cal-viewport {
    flex: 1;
    min-height: 0;
    overflow: auto;
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
  }
  #view-profile {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 12px 12px calc(68px + env(safe-area-inset-bottom));
    touch-action: pan-x pan-y;
  }
  #view-profile > #profile {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  #view-profile .profile {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 14px 12px 8px;
    overflow: hidden;
  }
  .person-cal,
  .plan-grid {
    align-content: start;
    align-items: start;
    gap: var(--cal-gap, 4px);
    width: calc(100% * var(--cal-scale, 1));
  }
  .plan-grid { --span-gap: var(--cal-gap, 4px); }
  #plan-board { --dow-fade: var(--paper); }
  .cal-viewport { --dow-fade: #fff; }
  .dow-float {
    display: block;
    position: sticky;
    top: 0;
    z-index: 6;
    width: calc(100% * var(--cal-scale, 1));
    margin: 0;
    padding: 0 0 4px;
    pointer-events: none;
    background: linear-gradient(to bottom, var(--dow-fade, var(--paper)) 72%, transparent);
  }
  .dow-float-track {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: var(--cal-gap, 4px);
  }
  .dow-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 18px;
    padding: 2px 0 1px;
    border-radius: 999px;
    background: transparent;
    color: #6f675c;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
  }
  .dow-short,
  .dow-long {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .dow-long { display: none; }
  .dow-chip.is-weekend { color: #b3a898; }
  .dow-chip.is-today { color: var(--green); }
  .dow-chip.is-today .dow-short,
  .dow-chip.is-today .dow-long {
    border-bottom: 1.5px solid currentColor;
    padding-bottom: 1px;
  }
  body[data-cal-zoom="1"] .dow-chip { font-size: 12px; }
  body[data-cal-zoom="2"] .dow-short,
  body[data-cal-zoom="3"] .dow-short { display: none; }
  body[data-cal-zoom="2"] .dow-long,
  body[data-cal-zoom="3"] .dow-long { display: block; }
  body[data-cal-zoom="2"] .dow-chip { font-size: 12px; letter-spacing: 0; }
  body[data-cal-zoom="3"] .dow-chip { font-size: 14px; letter-spacing: -0.02em; }
  .plan-grid > .plan-dow,
  .person-cal > .plan-dow {
    height: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
    line-height: 0;
  }
  .body { --span-gap: var(--gap); }
  .span-note {
    position: static;
    transform: none;
    left: auto;
    max-width: 100%;
    padding: 0;
    background: transparent;
    font-size: 9px;
  }
  .cell .span-note {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--paper);
  }
  .span-scribble { max-width: calc(100% - 8px); font-size: 10px; }
  .plan-dow,
  .day-tile,
  .day-blank,
  .person-day,
  .person-blank { min-width: 0; }
  .day-tile,
  .day-blank,
  .person-day,
  .person-blank {
    width: 100%;
    aspect-ratio: 1 / 1.28;
    min-height: 0;
    height: auto;
    align-self: start;
  }
  .day-blank,
  .person-blank { padding: 0; }
  .day-tile,
  .person-day {
    position: relative;
    padding: 0;
    gap: 0;
    overflow: visible;
    border-radius: var(--tile-radius, 12px);
    touch-action: pan-x pan-y;
    -webkit-touch-callout: none;
    user-select: none;
  }
  .tile-fit,
  .person-fit {
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: flex-start;
    gap: 1px;
    padding: 4px 2px 3px;
    overflow: hidden;
    text-align: center;
  }
  .person-num,
  .tile-num { flex: none; }
  .person-num {
    margin: 0;
    font-size: 11px;
    font-weight: 650;
    line-height: 1;
  }
  .person-note {
    flex: none;
    margin-top: auto;
    padding: 0 2px;
    font-size: 8px;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
  }
  body[data-cal-zoom="1"] .person-note { font-size: 9px; }
  body[data-cal-zoom="2"] .person-note { font-size: 11px; }
  body[data-cal-zoom="3"] .person-note { font-size: 13px; }
  .person-day em {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    margin: 0;
    padding: 0 1px;
    overflow: hidden;
    color: inherit;
    font-style: normal;
    font-weight: 650;
    font-size: 8px;
    letter-spacing: -0.04em;
    line-height: 1.05;
    text-align: center;
  }
  .person-chip {
    flex: 1;
    flex-direction: column;
    gap: 0;
    width: 100%;
    min-width: 0;
    min-height: 0;
    margin-top: 1px;
    padding: 1px;
    border-radius: 8px;
    overflow: hidden;
  }
  .person-chip .chip-letter { font-size: 16px; line-height: 1; }
  .person-chip .chip-dash { display: none; }
  .person-chip .chip-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
    overflow: hidden;
    white-space: normal;
    font-size: 9px;
    font-weight: 650;
    line-height: 1.05;
  }
  .person-chip .chip-sep { display: none; }
  .person-chip .chip-from,
  .person-chip .chip-to {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.05;
  }
  body[data-cal-zoom="1"] .person-chip .chip-letter { font-size: 24px; }
  body[data-cal-zoom="1"] .person-chip .chip-time { font-size: 10px; }
  body[data-cal-zoom="2"] .person-chip .chip-letter { font-size: 32px; }
  body[data-cal-zoom="2"] .person-chip .chip-time { font-size: 12px; }
  body[data-cal-zoom="3"] .person-chip .chip-letter { font-size: 44px; }
  body[data-cal-zoom="3"] .person-chip .chip-time { font-size: 15px; }
  body[data-cal-zoom="1"] .person-num,
  body[data-cal-zoom="1"] .tile-num { font-size: 13px; }
  body[data-cal-zoom="1"] .person-day em { font-size: 11px; letter-spacing: 0; }
  body[data-cal-zoom="2"] .person-num,
  body[data-cal-zoom="2"] .tile-num { font-size: 15px; }
  body[data-cal-zoom="2"] .person-day em { font-size: 14px; letter-spacing: 0; }
  body[data-cal-zoom="3"] .person-num,
  body[data-cal-zoom="3"] .tile-num { font-size: 18px; }
  body[data-cal-zoom="3"] .person-day em { font-size: 18px; letter-spacing: 0; }
  .span-bar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(62px + env(safe-area-inset-bottom));
    z-index: 16;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 252, 247, 0.98);
    box-shadow: 0 10px 28px rgba(60, 40, 20, 0.16);
  }
  .span-hint { font-size: 12px; }
  .span-limit,
  .span-bar .btn-solid,
  .span-bar .btn-ghost,
  .span-bar .btn-danger { min-height: 40px; }
  body.is-span-pick .plan-page { padding-bottom: calc(210px + env(safe-area-inset-bottom)); }
  .tile-codes,
  .tile-note,
  .tile-actions,
  .tile-state { display: none; }
  .tile-num { font-size: 11px; font-weight: 650; line-height: 1; color: var(--muted); }
  .tile-brief:empty { display: none; }
  .tile-brief {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    width: 100%;
    min-height: 0;
    max-width: 100%;
    overflow: hidden;
    color: var(--ink);
    font-weight: 750;
    line-height: 1.05;
    text-align: center;
  }
  .tile-mark { font-size: 15px; line-height: 1; }
  body[data-cal-zoom="1"] .tile-mark { font-size: 22px; }
  body[data-cal-zoom="2"] .tile-mark { font-size: 30px; }
  body[data-cal-zoom="3"] .tile-mark { font-size: 40px; }
  .tile-extra {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    color: #5c564c;
    font-size: 9px;
    font-weight: 650;
    line-height: 1.15;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .tile-extra.is-solo {
    color: var(--ink);
    font-size: 10px;
    font-weight: 750;
  }
  body[data-cal-zoom="1"] .tile-extra,
  body[data-cal-zoom="1"] .tile-extra.is-solo { font-size: 11px; -webkit-line-clamp: 2; }
  body[data-cal-zoom="2"] .tile-extra,
  body[data-cal-zoom="2"] .tile-extra.is-solo { font-size: 13px; -webkit-line-clamp: 3; }
  body[data-cal-zoom="3"] .tile-extra,
  body[data-cal-zoom="3"] .tile-extra.is-solo { font-size: 15px; -webkit-line-clamp: 4; }
  .plan-grid .span-note { font-size: 8px; }
  body[data-cal-zoom="1"] .plan-grid .span-note { font-size: 10px; }
  body[data-cal-zoom="2"] .plan-grid .span-note { font-size: 12px; }
  body[data-cal-zoom="3"] .plan-grid .span-note { font-size: 15px; }
  .day-tile.is-cant .tile-brief,
  .day-tile.is-cant .tile-mark { color: #c48b96; }
  .day-tile.is-closed,
  .day-tile.is-closed.is-weekend,
  .day-tile.is-closed.is-can,
  .day-tile.is-closed.is-cant {
    background: #eceae6;
    border-color: #e0dbd4;
    color: #b7aea3;
  }
  .day-tile.is-closed .tile-brief,
  .day-tile.is-closed .tile-mark,
  .day-tile.is-closed .tile-extra,
  .day-tile.is-closed .tile-extra.is-solo,
  .day-tile.is-closed .tile-num {
    color: #b7aea3;
  }
  .code, .note-add { width: 22px; height: 22px; }

  .popover {
    max-height: min(68dvh, 460px);
    overflow: auto;
  }
  .popover-actions { flex-wrap: wrap; gap: 8px; }
  #toasts {
    left: 12px;
    right: 12px;
    bottom: calc(68px + env(safe-area-inset-bottom));
  }
  .toast { max-width: none; }
}

.print-notes { display: none; }

@page sheet {
  size: A4 portrait;
  margin: 10mm 9mm;
}
@page person {
  size: A4 portrait;
  margin: 10mm;
}

@media print {
  body.print-month { page: sheet; }
  body.print-profile { page: person; }

  body, .app {
    height: auto;
    background: #fff;
    color: #000;
  }

  .template-tools,
  .bar-end,
  .bar-actions,
  .more-menu,
  .role-switch,
  .tabbar,
  .dow-float,
  .note-rail,
  .shift-bin,
  .grip,
  .hint,
  .span-note,
  .span-scribble,
  .day-tile.is-span::before,
  .cell.is-span::before,
  .day-inline-note,
  #toasts,
  #stamp,
  #popover,
  #note-view,
  #note-popover,
  #plan-popover,
  #confirm-dialog,
  .month-nav > button,
  .month-picker,
  .person-month button,
  .back-link {
    display: none !important;
  }

  .bar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6mm;
    padding: 0 0 3mm;
    border: 0;
    background: #fff;
  }
  #month-title {
    border: 0;
    background: transparent;
    padding: 0;
    font-size: 16pt;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: #000;
  }
  #month-title::after,
  #print-sheet { display: none !important; }

  main[hidden] { display: none !important; }
  .month-view,
  .page {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100%;
    height: auto;
    padding: 0;
    overflow: visible;
  }
  .month-stage { display: contents; }
  .side-legend {
    order: 0;
    align-self: stretch;
    display: flex;
    flex-direction: row;
    gap: 5mm;
    width: 100%;
    margin: 0 0 4mm;
    font-size: 8pt;
    font-weight: 450;
    color: #5c564e;
  }
  .side-legend p { gap: 1.4mm; margin: 0; }
  .swatch {
    width: 3.8mm;
    height: 3.8mm;
    border-radius: 0.8mm;
    background: #fff !important;
    color: #222 !important;
    border: 0.4pt solid #b7b1a8;
    box-shadow: none;
    font-size: 7pt;
    font-weight: 500;
  }

  .sheet-frame,
  .head-scroll,
  .body-scroll {
    display: block;
    overflow: visible;
    max-height: none;
    height: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
  }

  .sheet-frame { order: 1; width: 100%; }
  .head,
  .row {
    grid-template-columns: 16mm repeat(var(--cols), minmax(0, 1fr));
    gap: 0;
    align-items: stretch;
    width: 100%;
    padding: 0;
  }
  .head { padding: 0; border-bottom: 0.7pt solid #2a2724; }
  .row + .row { margin: 0; }
  .row { border-bottom: 0; }
  .body { padding: 0; }

  .corner,
  .day,
  .col-head,
  .cell {
    position: static;
    min-height: 0;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    outline: none;
    color: #1c1915;
    border: 0;
  }
  .corner { border-right: 0.7pt solid #a39e94; }
  .col-head,
  .cell { border-right: 0.4pt solid #d2ccc2; }
  .col-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4mm;
    height: auto;
    min-height: 8mm;
    padding: 1mm 0.6mm 1.2mm;
  }
  .name {
    writing-mode: horizontal-tb !important;
    transform: none !important;
    max-height: none;
    width: 100%;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    font-size: 8pt !important;
    font-weight: 550;
    letter-spacing: 0;
    white-space: nowrap;
    color: #1c1915;
  }
  .col-hours,
  .col-hours.is-over {
    display: block !important;
    max-width: 100%;
    overflow: hidden;
    font-size: 5.5pt;
    font-weight: 450;
    line-height: 1;
    letter-spacing: -0.01em;
    white-space: nowrap;
    color: #8a847a;
  }
  .day, .cell {
    min-height: 6.2mm;
    padding: 0;
    border-bottom: 0.55pt solid #b7b1a6 !important;
  }
  .cell {
    align-items: center;
    justify-content: center;
  }
  .day,
  .day.has-note,
  .day.has-note.is-weekend,
  .day.has-note.has-alert,
  .day.has-note.has-alert.is-weekend,
  .day.is-closed {
    display: grid !important;
    grid-template-columns: 8mm minmax(0, 1fr);
    align-items: center !important;
    justify-content: stretch !important;
    width: 100%;
    column-gap: 0;
    padding: 0 1.1mm 0 0.2mm !important;
    border-radius: 0 !important;
    border-top: 0 !important;
    border-left: 0 !important;
    border-right: 0.7pt solid #a39e94 !important;
    border-bottom: 0.55pt solid #b7b1a6 !important;
    font-weight: 450;
    background-clip: padding-box;
  }
  .day > .day-inline-note,
  .day.has-note::after,
  .day.has-alert::after {
    display: none !important;
    content: none !important;
  }
  .day > span {
    display: block !important;
    font-size: 7pt !important;
    font-weight: 450;
    line-height: 1;
    color: #8a847a;
    text-align: left;
    white-space: nowrap;
  }
  .day strong {
    display: block;
    font-size: 8pt !important;
    font-weight: 500 !important;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    text-align: right;
    white-space: nowrap;
    color: #1c1915;
    background: transparent !important;
    min-width: 0;
    height: auto;
  }
  .day.is-today strong {
    background: transparent !important;
    color: #1c1915;
    min-width: 0 !important;
    height: auto !important;
    border-radius: 0 !important;
  }
  .day em { display: none !important; }
  .day.is-weekend,
  .cell.is-weekend,
  .row.is-closed .day,
  .row.is-closed .cell {
    background: #f6f3ee !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .chip,
  .chip[data-label="R"],
  .chip[data-label="M"],
  .chip[data-label="O"],
  .chip[data-label="X"],
  .removal {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    outline: none;
  }
  .chip,
  .chip-letter { font-weight: 500 !important; }
  .chip.is-draft { outline: 0.45pt dashed #a39e96; outline-offset: 1px; }
  .chip-letter { font-size: 8pt !important; letter-spacing: 0.01em; }
  .chip-time, .chip-dash { font-size: 6.5pt; font-weight: 450; color: #5c564e; }
  .removal { display: none !important; }

  .print-notes {
    display: block;
    order: 2;
    width: 100%;
    margin-top: 6mm;
    padding-top: 3mm;
    border-top: 0.35pt solid #e4dfd6;
  }
  .print-notes h2 {
    margin: 0 0 1.6mm;
    font-size: 8pt;
    font-weight: 550;
    letter-spacing: 0.04em;
    text-transform: none;
    color: #8a847a;
  }
  .print-notes p {
    display: grid;
    grid-template-columns: 32mm 1fr;
    gap: 2mm;
    margin: 0;
    font-size: 9pt;
    line-height: 1.45;
    color: #1c1915;
  }
  .print-note-date {
    display: block;
    min-width: 0;
    color: #5c564e;
    font-variant-numeric: tabular-nums;
  }
  .print-notes .is-alert .print-note-body { font-weight: 700; }
  .print-notes p[data-color] .print-note-body::before {
    content: "";
    display: inline-block;
    width: 2.4mm;
    height: 2.4mm;
    margin-right: 1.5mm;
    border-radius: 99px;
    background: var(--note-dot);
    vertical-align: -0.2mm;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-note-detail {
    display: block;
    margin-top: 0.4mm;
    color: #5c564e;
    font-size: 8pt;
    font-weight: 450;
    white-space: pre-wrap;
  }

  .profile {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .profile h1 { font-size: 16pt; }
  .profile .email { margin: 0 0 3mm; font-size: 9pt; color: #000; }
  .person-stats { margin-bottom: 3mm; }
  .person-stats strong { font-size: 11pt; color: #000; }
  .person-stats span,
  .person-stats strong.is-over { font-size: 8pt; color: #000; }
  .person-month { margin: 0 0 3mm; }
  .person-cal { gap: 0; }
  .plan-dow {
    visibility: visible !important;
    height: auto !important;
    min-height: 0;
    overflow: visible !important;
    line-height: 1.2;
    font-size: 8pt;
  }
  .person-blank { min-height: 0; }
  .person-day,
  .person-day.is-weekend,
  .person-day.is-closed,
  .person-day.is-today {
    min-height: 22mm;
    padding: 1.5mm;
    border-radius: 0;
    border: 0.4pt solid #000;
    background: #fff !important;
    box-shadow: none;
    color: #000;
    break-inside: avoid;
  }
  .person-day.is-weekend,
  .person-day.is-closed {
    background: #eee !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .person-dow, .person-num, .person-day em, .person-note, .person-note.is-alert { color: #000; font-size: 8pt; }
  .person-chip { min-height: 0; }
}
