:root {
  --ink: #203a31;
  --muted: #52655d;
  --line: #dce5dc;
  --green: #285744;
  --paper: #f5f7f2;
  --tint: #edf3eb;
  --clash-ink: #87361c;
  --clash-bg: #fff3e7;
  --clash-border: #e6a079;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", sans-serif;
}
button, input, select, textarea { font: inherit; }
button {
  cursor: pointer;
  color: var(--ink);
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  padding: 8px 12px;
  min-height: 40px;
  touch-action: manipulation;
}
button:hover { background: var(--tint); }
button.primary { background: var(--green); color: white; border-color: var(--green); font-weight: 700; }
button.primary:hover { background: #1e4837; }
button:disabled { opacity: .65; cursor: wait; }
:focus-visible { outline: 3px solid #568572; outline-offset: 2px; }
summary { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }

.site-header { background: white; border-bottom: 1px solid var(--line); }
.site-header-inner, main { max-width: 1280px; margin-inline: auto; padding-inline: 28px; }
.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 20px;
  padding-block: 14px;
}
.brand { font-size: 17px; font-weight: 700; }
.brand small, .caption { color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.brand small { display: block; }
.access-strip { display: flex; align-items: center; gap: 8px; font-size: 12px; }
#permissionLabel { border-radius: 6px; background: var(--tint); padding: 4px 8px; }
main { padding-block: 24px; min-width: 0; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.page-heading h1 { margin: 0; font-size: 26px; }
.add-dock:has(#add[hidden]) { display: none; }
.controls { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.project-filter { margin-bottom: 12px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.project-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
#addProject { border-color: #b7c9bb; color: var(--green); font-weight: 700; white-space: nowrap; }
#projectError { color: #a23528; font-size: 13px; }
#projectError:empty { display: none; }
.project-select {
  display: grid;
  grid-template-columns: auto minmax(0, 320px);
  gap: 10px;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
}
.project-select select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 7px 10px;
  background: var(--tint);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
}
.project-select select.has-project-color { border-inline-start: 5px solid var(--selected-project-color); }
.project-select select, .field select {
  appearance: none;
  padding-inline-end: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23203a31' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}
.project-options { margin-top: 6px; }
.project-options summary, .management summary { width: fit-content; padding-block: 8px; color: var(--muted); font-size: 13px; }
#projects { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr)); gap: 6px; padding: 4px 0; }
.project {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 8px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-wrap: anywhere;
}
.project input, .check-field input { accent-color: var(--green); width: 18px; height: 18px; margin: 0; flex-shrink: 0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.toolbar, .nav, .views { display: flex; align-items: center; gap: 6px; }
.toolbar { justify-content: space-between; gap: 10px; }
.nav strong { min-width: 155px; text-align: center; font-size: 18px; }
.nav button { min-width: 44px; }
#prev, #next { font-size: 22px; line-height: 1; }
.views { gap: 4px; }
.views button { white-space: nowrap; border-color: transparent; }
.views button.active { background: var(--tint); border-color: #c7d8c9; color: var(--green); font-weight: 700; }
.calendar-summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-block: 10px; color: var(--muted); font-size: 12px; }
.calendar-summary button { min-height: 36px; color: var(--green); }
.calendar { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: white; }
.saturday { --day-ink: #264d83; --day-tint: #e7efff; --day-fill: #f4f7fe; }
.sunday, .holiday { --day-ink: #922d39; --day-tint: #fce7eb; --day-fill: #fff3f5; }
.weekday:is(.saturday,.sunday,.holiday),
.agenda-date:is(.saturday,.sunday,.holiday),
.gantt-days > span:is(.saturday,.sunday,.holiday) {
  background-color: var(--day-tint);
  color: var(--day-ink);
  font-weight: 700;
}
.holiday-name {
  color: var(--day-ink);
  font-size: 11px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.weekday .holiday-name { display: block; }
.agenda-date .holiday-name { margin-inline-start: 7px; }
.day-holiday-mark { display: none; }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--tint); }
.weekday { padding: 10px 3px; text-align: center; color: var(--muted); font-size: 12px; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.day { min-height: 118px; padding: 5px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); cursor: pointer; touch-action: manipulation; }
.day:nth-child(7n) { border-right: 0; }
.day:hover, .day.out { background: #fafbf8; }
.day.out { color: var(--muted); }
.day:is(.saturday,.sunday,.holiday) { color: var(--day-ink); background-color: var(--day-fill); }
.day-number { display: inline-grid; place-items: center; min-height: 0; width: 28px; height: 28px; padding: 0; border: 0; background: transparent; margin-bottom: 4px; font-size: 13px; color: inherit; }
.today .day-number { background: var(--green); color: white; border-radius: 50%; }
.day.selected { box-shadow: inset 0 0 0 2px #82a894; }
.day-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin-bottom: 4px; }
.day-heading .day-number { margin-bottom: 0; }
.day.holiday .day-number { font-weight: 700; }
.day.has-clash { background: var(--clash-bg); }
.day-clash, .clash-tag {
  display: inline-block;
  border-radius: 4px;
  background: #f9dfce;
  color: var(--clash-ink);
  padding: 2px 5px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}
.clock { white-space: nowrap; font-variant-numeric: tabular-nums; }
.event {
  display: block;
  width: 100%;
  margin-bottom: 4px;
  min-height: 0;
  border: 0;
  border-inline-start: 5px solid var(--event);
  border-radius: 5px;
  background: color-mix(in srgb, var(--event) 24%, white);
  color: var(--ink);
  padding: 5px 6px;
  text-align: left;
  font-size: 12px;
  overflow: hidden;
}
.event:hover, .list-item:hover { background: color-mix(in srgb, var(--event) 31%, white); }
.event b, .event small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event small { font-size: 11px; }
.month-event {
  padding: 6px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.month-event > span:not(.clash-tag), .month-event strong { display: block; }
.month-event .month-time { font-size: 11px; color: var(--muted); }
.month-event strong { margin-block: 2px; font-size: 13px; }
.month-event .month-project {
  margin-top: 3px;
  padding: 2px 4px;
  border-radius: 4px;
  background: var(--event);
  color: var(--event-ink);
  font-size: 11px;
  font-weight: 600;
}
.month-event .clash-tag { margin-top: 4px; }
.month-event.has-clash { box-shadow: inset 0 0 0 1px var(--clash-border); }
.month-event:focus-visible { outline-offset: -2px; }
.mobile-label, .day-count, .day-agenda, .day-project-colors { display: none; }
.empty { padding: 36px 14px; text-align: center; color: var(--muted); }
.footer { margin-top: 12px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; color: var(--muted); font-size: 12px; }
.management { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 8px; }
.side-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.agenda-date { margin: 0; padding: 8px 14px; background: var(--tint); color: var(--green); font-size: 14px; font-weight: 700; }
.agenda-date .today-label { margin-inline-start: 7px; font-size: 11px; }
.list-item {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-inline-start: 5px solid var(--event);
  border-radius: 0;
  text-align: left;
}
.list-item:focus-visible, .day-number:focus-visible { outline-offset: -3px; }
.list-item .time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.list-item .details, .list-item .details > * { display: block; min-width: 0; overflow-wrap: anywhere; }
.list-item .project-tag, .color-preview .project-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--event);
  color: var(--event-ink);
  font-size: 12px;
  font-weight: 600;
}
.list-item .project-tag { margin-top: 4px; }
.list-item .place { margin-top: 4px; font-size: 12px; color: var(--muted); }
.list-item .chevron { align-self: center; color: var(--muted); }
.list-conflict {
  grid-column: 2 / -1;
  display: flex;
  align-items: start;
  flex-wrap: wrap;
  gap: 5px 9px;
  padding: 7px 9px;
  border: 1px solid var(--clash-border);
  border-radius: 6px;
  background: var(--clash-bg);
  color: var(--clash-ink);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.conflict-lines { display: grid; min-width: 0; gap: 3px; }
.conflict-line { display: flex; flex-wrap: wrap; gap: 1px 8px; }
.conflict-window { font-weight: 700; }
.conflict-project { min-width: 0; overflow-wrap: anywhere; }

.week-wrap, .gantt-wrap { overflow: auto; max-height: 70vh; }
.week-head, .week-body { display: grid; grid-template-columns: 50px repeat(7, minmax(110px, 1fr)); min-width: 820px; }
.week-head, .gantt-header { position: sticky; top: 0; background: var(--tint); z-index: 4; }
.hours, .week-head > div:first-child { position: sticky; left: 0; background: white; z-index: 3; }
.week-head > div:first-child { background: var(--tint); }
.hours { height: 1152px; font-size: 10px; color: var(--muted); }
.hour { position: absolute; right: 8px; }
.lane { height: 1152px; position: relative; border-left: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0 47px, var(--line) 47px 48px); touch-action: manipulation; }
.lane .event { position: absolute; min-height: 20px; margin: 0; padding: 3px; z-index: 1; }
.gantt-grid { min-width: 1050px; }
.gantt-header, .gantt-row { display: grid; grid-template-columns: 180px 1fr; }
.gantt-name { position: sticky; left: 0; z-index: 2; padding: 10px; background: white; border: 1px solid var(--line); border-width: 0 1px 1px 0; font-size: 12px; overflow-wrap: anywhere; }
.gantt-header .gantt-name, .gantt-project { background: var(--tint); }
.gantt-days { display: grid; grid-template-columns: repeat(var(--days), 1fr); }
.gantt-days span { padding: 10px 0; border-right: 1px solid var(--line); text-align: center; font-size: 11px; }
.lane:is(.saturday,.sunday,.holiday) { background-color: var(--day-fill); }
.gantt-track { position: relative; min-height: 58px; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to right, transparent 0 calc(100% / var(--days) - 1px), var(--line) calc(100% / var(--days) - 1px) calc(100% / var(--days))); }
.gantt-bar { position: absolute; top: 10px; min-height: 38px; min-width: 8px; border: 0; border-radius: 5px; border-inline-start: 5px solid var(--event); padding: 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; background: var(--event); color: var(--event-ink); }
.gantt-bar:hover { background: var(--event); box-shadow: inset 0 0 0 2px currentColor; }
.gantt-project { position: sticky; left: 0; padding: 8px 10px; font-size: 13px; }
.gantt-note { padding: 10px; color: var(--muted); font-size: 12px; }

dialog {
  width: min(520px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  box-shadow: 0 20px 80px #20382d30;
}
dialog::backdrop { background: #172e275e; }
dialog h2 { margin: 0 0 14px; font-size: 20px; }
.field { display: block; min-width: 0; margin-bottom: 12px; font-size: 13px; font-weight: 600; }
.field input, .field select, .field textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  margin-top: 4px;
  padding: 8px 9px;
  border: 1px solid #bbcbbf;
  border-radius: 7px;
  background-color: white;
  color: var(--ink);
  font-size: 16px;
  font-weight: 400;
}
.field :disabled { opacity: 1; color: var(--ink); -webkit-text-fill-color: var(--ink); background: var(--paper); }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.access-item { padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.access-item p { white-space: pre-wrap; font-size: 13px; margin: 5px 0; }
.access-item button { margin-inline-end: 6px; }
#requestError { color: #9a2927; }

#editor { padding: 0; width: min(560px, calc(100% - 24px)); overflow: hidden; }
#eventForm { display: flex; flex-direction: column; max-height: calc(100dvh - 26px); }
.editor-heading, .editor-fields, .editor-footer { padding: 12px 18px; }
.editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); }
.editor-heading h2 { margin: 0; }
.editor-fields { min-height: 0; overflow: auto; overscroll-behavior: contain; scroll-padding: 10px; }
.editor-footer { border-top: 1px solid var(--line); }
.editor-footer:has(#saveEvent[hidden]):has(#editorStatus:empty), #editorStatus:empty { display: none; }
.editor-footer button { width: 100%; min-height: 46px; }
#editorStatus { margin: 0 0 8px; font-size: 13px; }
.check-field { display: flex; gap: 8px; min-height: 42px; align-items: center; font-size: 14px; cursor: pointer; }
.check-field small { display: block; color: var(--muted); font-size: 12px; }
.optional-fields { border-block: 1px solid var(--line); margin-block: 8px; }
.optional-fields summary { padding-block: 11px; font-weight: 600; }
.optional-fields summary span { color: var(--muted); font-weight: 400; font-size: 12px; }
.continue-entry { padding-block: 6px; }
.editor-tools { display: flex; gap: 8px; }
.editor-tools .danger { color: #9a2927; }
.notice {
  margin-block: 10px;
  padding: 9px 11px;
  border: 1px solid var(--clash-border);
  border-radius: 6px;
  background: var(--clash-bg);
  color: var(--clash-ink);
  font-size: 13px;
}
.notice p { margin: 4px 0; }
.notice ul { margin: 4px 0 0; padding-inline-start: 18px; }
.notice .conflict-project { display: block; }
.notice li + li { margin-top: 4px; }
.toast { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom)); left: 50%; z-index: 10; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); padding: 10px 14px; border-radius: 8px; background: var(--ink); color: white; }
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.gate-card { width: min(440px, 100%); padding: 24px; background: white; border: 1px solid var(--line); border-radius: 14px; }
.gate-card h1 { font-size: 21px; }
.sub { color: var(--muted); font-size: 13px; }

@media (601px <= width <= 850px) {
  main { padding-inline: 16px; }
  .month-event { padding-inline: 4px; }
}

@media (max-width: 600px) {
  button { min-height: 44px; }
  .site-header-inner, main { padding-inline: 12px; }
  .site-header-inner { padding-block: 4px; min-height: 52px; gap: 4px 8px; }
  .brand { font-size: 16px; }
  .brand small, .wide-label { display: none; }
  .mobile-label { display: inline; }
  .access-strip { gap: 4px; font-size: 11px; }
  .access-strip button { padding-inline: 7px; font-size: 12px; }
  main { padding-top: 8px; }
  .page-heading { margin-bottom: 8px; gap: 4px 8px; }
  .page-heading h1 { font-size: 17px; }
  .page-actions button:not(#add) { padding-inline: 8px; font-size: 12px; }
  .controls { padding: 8px; }
  .project-filter { margin-bottom: 7px; padding-bottom: 7px; }
  .project-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
  #addProject { padding-inline: 8px; font-size: 13px; }
  .project-select { display: block; }
  .project-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .project-options { margin: 0; }
  .project-options summary { min-height: 44px; padding: 12px 4px; white-space: nowrap; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 5px; }
  .nav strong { min-width: 0; flex: 1; font-size: 16px; }
  .views { gap: 2px; padding: 2px; border-radius: 8px; background: var(--tint); }
  .views button { flex: 1; padding-inline: 4px; background: transparent; font-size: 13px; }
  .views button.active { background: white; }
  .calendar-summary { margin-block: 6px; }
  .calendar-summary button { min-height: 44px; }
  .stats-breakdown { display: none; }
  #workspace:has(#add:not([hidden])) main { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
  .add-dock {
    position: fixed;
    inset: auto 0 0;
    z-index: 6;
    padding: 8px max(12px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    background: white;
    border-top: 1px solid var(--line);
  }
  #add { width: 100%; min-height: 46px; }
  #workspace:has(#add:not([hidden])) ~ .toast { bottom: calc(68px + env(safe-area-inset-bottom)); }
  .list-item {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 8px;
    row-gap: 4px;
    padding: 10px 12px;
  }
  .list-item .time { grid-area: 1 / 1; font-size: 13px; font-weight: 600; }
  .list-item .details { grid-area: 2 / 1; }
  .list-item .details strong { font-size: 16px; line-height: 1.4; }
  .list-item .project-tag { margin-top: 5px; }
  .list-item .chevron { grid-area: 1 / 2 / span 2; font-size: 18px; }
  .list-conflict { grid-column: 1 / -1; margin-top: 3px; }
  .list-duration { margin-inline-start: 7px; color: var(--muted); font-size: 11px; font-weight: 400; }

  .weekdays .weekday { padding: 6px 2px; }
  .day { position: relative; isolation: isolate; min-height: 46px; text-align: center; padding: 1px; }
  .day-heading { display: block; margin: 0; }
  .day-heading > .holiday-name, .day-heading .day-clash, .day > .event { display: none; }
  .day-number, .today .day-number {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 1px;
    width: 100%;
    min-height: 44px;
    height: auto;
    padding: 3px 0 2px;
    border-radius: 6px;
    background: transparent;
    color: inherit;
  }
  .day-label-line { display: inline-flex; align-items: center; gap: 1px; }
  .day-holiday-mark {
    display: inline-block;
    padding: 0 2px;
    border-radius: 3px;
    background: var(--day-tint);
    color: var(--day-ink);
    font-size: 9px;
    font-weight: 700;
  }
  .day-digit {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    font-size: 14px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }
  .today .day-digit { color: white; background: var(--green); border-radius: 50%; }
  .day.selected { box-shadow: none; }
  .day.selected .day-number { background: #e1eee6; box-shadow: inset 0 0 0 2px #709a84; }
  .day.has-clash.selected .day-number { background: var(--clash-bg); }
  .day.has-project-colors .day-number, .day.has-project-colors.selected .day-number { background: transparent; }
  .day.has-project-colors .day-number, .day.has-project-colors .batch-day {
    color: color-mix(in srgb, var(--day-ink, var(--ink)) 76%, black);
  }
  .day-count { display: block; font-size: 10px; font-weight: 700; line-height: 1.3; color: var(--green); }
  .day-count-clash { padding: 0 3px; border-radius: 3px; background: #f9dfce; color: var(--clash-ink); }
  .day-count-colored { padding: 0 4px; border-radius: 4px; color: var(--event-ink); background: var(--event); }
  .day.out .day-count:not(.day-count-clash,.day-count-colored) { color: var(--muted); }
  .day-project-colors {
    position: absolute;
    inset: 1px;
    z-index: -1;
    display: flex;
    overflow: hidden;
    border-radius: 5px;
    pointer-events: none;
  }
  .day-project-colors i {
    position: relative;
    flex: 1;
    min-width: 0;
    background: var(--band-color);
    background: color-mix(in srgb, var(--band-color) 34%, white);
  }
  .day-project-colors i::after {
    position: absolute;
    inset: auto 0 0;
    height: 4px;
    content: "";
    background: var(--band-color);
  }
  .day-project-colors i + i { border-inline-start: 1px solid #fffa; }
  .day-project-colors:has(i:nth-child(6)) i { border-inline-start: 0; }
  .day-agenda:not(:empty) { display: block; margin-top: 10px; background: white; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
  .agenda-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; gap: 4px; }
  .agenda-head h2 { margin: 0; font-size: 16px; }
  .agenda-head p { margin: 0; color: var(--muted); font-size: 12px; }
  #backToMonth { padding-inline: 7px; font-size: 12px; }
  .week-agenda-heading { display: flex; align-items: center; justify-content: space-between; background: var(--tint); }
  .week-agenda-heading .agenda-date { padding: 8px 10px; background: transparent; scroll-margin-block: 8px 108px; }
  .week-agenda-heading button { margin: 2px 4px; min-width: 66px; padding-inline: 6px; font-size: 12px; }
  .week-agenda-day.is-selected .week-agenda-heading { background: #e1eee6; box-shadow: inset 3px 0 0 var(--green); }
  .week-agenda-heading:is(.saturday,.sunday,.holiday) { background: var(--day-tint); }
  .week-agenda-heading:is(.saturday,.sunday,.holiday) .agenda-date { color: var(--day-ink); }
  .selected-label { margin-inline-start: 7px; color: var(--muted); font-size: 11px; }
  .agenda-empty { margin: 0; padding: 10px; color: var(--muted); font-size: 13px; }
  .week-wrap, .gantt-wrap { max-height: 62dvh; }
  .gantt-header, .gantt-row { grid-template-columns: 118px 1fr; }
  #editor {
    position: fixed;
    inset: var(--editor-top, 0px) 0 auto;
    margin: 0;
    width: 100%;
    max-width: 100%;
    height: min(100dvh, var(--editor-height, 100dvh));
    max-height: none;
    border: 0;
    border-radius: 0;
  }
  #eventForm { height: 100%; max-height: none; }
  .editor-fields { flex: 1; }
  .editor-heading { padding-top: max(8px, env(safe-area-inset-top)); }
  .editor-footer { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}

.page-heading { flex-wrap: wrap; }
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.assignment-entry { color: var(--green); border-color: #b7c9bb; background: var(--tint); font-weight: 700; }
.assignment-dialog { width: min(580px, calc(100% - 24px)); }
.assignment-heading { display: flex; justify-content: space-between; align-items: start; gap: 10px; margin-bottom: 12px; }
.assignment-heading h2 { margin: 4px 0; }
.assignment-heading button { flex-shrink: 0; }
#assignmentForm > p { color: var(--muted); font-size: 14px; }
#assignmentFields { border: 0; padding: 0; margin: 0; min-width: 0; }
.assignment-submit { position: sticky; bottom: -22px; padding: 8px 0; background: white; }
.assignment-submit button { width: 100%; }
#assignmentError { color: #a23528; margin: 0 0 8px; font-size: 13px; }
#assignmentError:empty, #assignmentInboxStatus:empty { display: none; }
#assignmentReceipt { padding: 12px; background: var(--tint); border-radius: 8px; overflow-wrap: anywhere; }
#assignmentReceipt p { margin-bottom: 0; }
.assignment-card { padding: 14px 0; border-bottom: 1px solid var(--line); }
.assignment-card h3 { margin: 0 0 4px; overflow-wrap: anywhere; }
.assignment-details { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; font-size: 14px; }
.assignment-details dt { font-weight: 600; }
.assignment-details dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.assignment-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.assignment-card-actions select { min-height: 44px; }
#moreAssignments { margin-top: 14px; }


@media (max-width: 600px) {
  .assignment-dialog { padding: 14px; }
  .assignment-heading { position: sticky; top: -14px; z-index: 1; margin-bottom: 8px; padding-block: 4px; background: white; }
  .assignment-heading h2 { font-size: 18px; }
  .assignment-submit { bottom: -14px; }
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}
.project-actions button { font-size: 13px; }
#toggleBatch[aria-pressed="true"] { background: var(--tint); color: var(--green); border-color: #82a894; }
.batch-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 9px 12px;
  border: 1px solid #a8c0ae;
  border-radius: 8px;
  background: var(--tint);
}
.batch-toolbar small { display: block; color: var(--muted); font-size: 11px; }
.batch-toolbar button { white-space: nowrap; }
.batch-day {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px;
  min-height: 36px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.batch-day input, .batch-target input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--green);
  flex-shrink: 0;
}
.day.batch-checked { box-shadow: inset 0 0 0 2px var(--green); }
#batchDialog { width: min(620px, calc(100% - 20px)); }
#batchTargets h3, #batchPreview h3 { margin: 12px 0 5px; font-size: 15px; }
#batchTargets .sub { margin-bottom: 6px; }
.batch-target-list {
  max-height: 230px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.batch-target {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
  cursor: pointer;
  font-size: 13px;
}
.batch-target:last-child { border-bottom: 0; }
.batch-target small, #batchPreview li span { display: block; color: var(--muted); }
#batchPreview {
  scroll-margin-bottom: 65px;
  margin-block: 12px;
  padding: 9px 12px;
  background: var(--tint);
  border-radius: 8px;
}
#batchPreview h3 { margin-top: 0; }
#batchPreview ul { max-height: 220px; overflow: auto; margin: 0; padding-inline-start: 22px; font-size: 13px; overflow-wrap: anywhere; }
#batchPreview li + li { margin-top: 6px; }
#batchError { color: #a23528; font-size: 13px; scroll-margin-bottom: 65px; }
#batchError:empty { display: none; }
.batch-dialog-actions { position: sticky; bottom: -22px; margin-top: 12px; padding-block: 8px; background: white; }

@media (max-width: 600px) {
  .project-actions button { font-size: 12px; padding-inline: 7px; }
  #workspace:has(#batchToolbar:not([hidden])) .add-dock { display: none; }
  .batch-toolbar {
    position: fixed;
    inset: auto 0 0;
    z-index: 6;
    margin: 0;
    border-radius: 0;
    border-width: 1px 0 0;
    padding-bottom: calc(7px + env(safe-area-inset-bottom));
    font-size: 13px;
  }
  .batch-toolbar button { font-size: 13px; }
  .batch-day { width: 100%; min-height: 44px; flex-direction: column-reverse; justify-content: center; gap: 2px; padding: 2px 0; font-size: 12px; }
  .batch-day input { width: 15px; height: 15px; }
  .day.batch-checked .batch-day { border-radius: 6px; box-shadow: inset 0 0 0 2px var(--green); }
  #batchDialog { padding: 14px; }
  .batch-dialog-actions { bottom: -14px; }
}


.project-palette-field { margin: 0 0 12px; padding: 0; min-width: 0; border: 0; }
.project-palette-field legend { margin-bottom: 6px; padding: 0; font-size: 13px; font-weight: 600; }
.project-palette { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.color-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 2px;
  font-size: 11px;
  line-height: 1.3;
}
.color-swatch[aria-pressed="true"] {
  background: var(--tint);
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
  font-weight: 700;
}
.color-sample { width: 24px; height: 17px; border: 1px solid #0002; border-radius: 4px; background: var(--sample); }
.custom-color { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.custom-color input { width: 54px; min-height: 40px; margin: 0; padding: 4px; }
.color-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 7px;
  padding: 6px 8px;
  border-inline-start: 5px solid var(--event);
  border-radius: 5px;
  background: color-mix(in srgb, var(--event) 24%, white);
}
.color-preview output { font: 12px ui-monospace, monospace; }

@media (max-width: 600px) {
  .project-palette { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .color-preview { position: sticky; top: -14px; z-index: 1; }
  #projectDialog { padding: 14px; }
  #projectDialog .dialog-actions { position: sticky; bottom: -14px; padding-block: 6px; background: white; }
}

.move-hint { color: var(--muted); text-align: end; }
.movable-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  background: white;
}
.movable-list-item .list-item { border-bottom: 0; }
.movable-list-item .chevron { display: none; }
.move-handle {
  align-self: center;
  justify-self: center;
  width: 48px;
  min-height: 44px;
  scroll-margin-block-end: 78px;
  padding: 3px;
  color: var(--green);
  font-size: 11px;
  font-weight: 600;
}
.move-handle span { display: block; font-size: 17px; line-height: 1; }
.month-event[data-drag-event], .move-handle[data-drag-event] { cursor: grab; user-select: none; }
.move-handle[data-drag-event] { touch-action: none; -webkit-touch-callout: none; }
.dragging-schedule, .dragging-schedule * { cursor: grabbing !important; user-select: none; }
.schedule-drag-ghost {
  position: fixed;
  z-index: 100;
  max-width: min(250px, 70vw);
  padding: 6px 10px;
  border-radius: 7px;
  background: var(--green);
  color: white;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  overflow-wrap: anywhere;
}
.day.move-drop-target { outline: 3px solid var(--green); outline-offset: -3px; }
.move-event-name, .move-result { margin-bottom: 8px; font-weight: 700; overflow-wrap: anywhere; }
#moveError { color: #a23528; font-size: 13px; }
#moveError:empty { display: none; }

.share-qr {
  display: block;
  width: 192px;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.share-qr-actions { display: flex; justify-content: center; margin: 4px 0 10px; }
.share-qr-actions a { display: inline-flex; align-items: center; min-height: 40px; color: var(--green); font-size: 13px; }
#shareStatus:empty, #adminLinkStatus:empty { display: none; }

@media (max-width: 600px) {
  #shareDialog, #adminLinkDialog { padding: 14px; }
}
