:root {
  color-scheme: light;
  --paper: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f4f4f8;
  --ink: #202027;
  --muted: #73737d;
  --faint: #aaaab3;
  --line: #e7e7ed;
  --line-strong: #d7d7df;
  --accent: #5b5fe9;
  --accent-soft: #eef0ff;
  --accent-wash: #f7f7ff;
  --accent-dark: #484ccb;
  --danger: #d70015;
  --week-height: 126px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-ui: "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  font-family: var(--font-ui);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
  text-rendering: auto;
}

* { box-sizing: border-box; font-family: var(--font-ui); }
html { width: 100%; height: 100%; overflow: hidden; background: var(--paper); font-family: var(--font-ui); }
body { margin: 0; min-width: 320px; width: 100%; height: 100%; overflow: hidden; background: var(--paper); color: var(--ink); font-family: var(--font-ui); font-weight: 400; }
button, input, select, textarea { font: inherit; color: inherit; font-family: var(--font-ui); }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 82%, white); outline-offset: 2px; }
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.site-frame { width: 100%; height: 100%; min-height: 0; overflow: hidden; }
.app { width: 100%; height: 100svh; height: 100dvh; min-height: 0; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); }

.calendar-header {
  position: relative;
  z-index: 20;
  flex: 0 0 auto;
  padding-top: var(--safe-top);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topline {
  height: 44px;
  padding: 0 8px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { min-width: 0; display: inline-flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 700; letter-spacing: normal; }
.top-actions { display: flex; align-items: center; gap: 2px; }
.icon-button, .month-nav {
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
}
.icon-button svg, .month-nav svg { width: 20px; height: 20px; }

.monthbar {
  min-height: 42px;
  padding: 0 8px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px auto;
  align-items: center;
  border-top: 1px solid color-mix(in srgb, var(--line) 68%, transparent);
}
.month-title {
  min-width: 0;
  min-height: 40px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: clamp(19px, 5.2vw, 22px);
  font-weight: 700;
  letter-spacing: normal;
}
.month-title svg { width: 16px; height: 16px; flex: 0 0 auto; }
.today-button {
  min-width: 48px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line-strong));
  border-radius: 8px;
  background: var(--accent-wash);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
}

.category-filter {
  height: 34px;
  padding: 0 10px;
  display: flex;
  align-items: stretch;
  gap: 17px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  border-top: 1px solid color-mix(in srgb, var(--line) 54%, transparent);
}
.category-filter::-webkit-scrollbar { display: none; }
.filter-tab {
  position: relative;
  flex: 0 0 auto;
  min-width: 0;
  padding: 1px 0 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.filter-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: transparent;
}
.filter-tab.is-active { color: color-mix(in srgb, var(--role-color, var(--accent)) 46%, var(--ink)); font-weight: 700; }
.filter-tab.is-active::after { background: var(--role-color, var(--accent)); }

.connection-banner {
  min-height: 34px;
  padding: 8px 13px;
  border-bottom: 1px solid #dfc28f;
  background: #fff2d8;
  color: #704b12;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

.calendar-main { width: 100%; flex: 1 1 auto; min-height: 0; overflow: hidden; outline: none; }
.calendar-view { width: 100%; height: 100%; min-height: 0; overflow: hidden; }
.calendar-board { position: relative; width: 100%; height: 100%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); }
.weekday-row {
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: center;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: normal;
  text-align: center;
}
.weekday-row span:nth-child(6) { color: #4b6fb7; }
.weekday-row span:last-child { color: #bf5963; }
.month-grid {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(var(--week-count, 6), minmax(0, 1fr));
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.calendar-week {
  --lane-count: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  --event-row-height: min(18px, calc((100% - 22px) / var(--lane-count)));
  grid-template-rows: 22px repeat(var(--lane-count), minmax(0, var(--event-row-height))) minmax(0, 1fr);
  align-content: stretch;
  min-width: 0;
  min-height: 0;
  height: auto;
  position: relative;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.calendar-week:last-child { border-bottom: 0; }
.day-cell {
  position: relative;
  z-index: 0;
  grid-row: 1 / -1;
  min-width: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.day-cell.is-sunday { border-right: 0; }
.day-cell.is-saturday, .day-cell.is-sunday { background: transparent; }
.day-cell.is-outside { background: var(--surface); cursor: default; pointer-events: none; }
.day-cell.is-selected { z-index: 1; }
.day-cell.is-selected .day-number { background: var(--accent-soft); color: var(--accent-dark); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 52%, transparent); border-radius: 50%; }
.day-number {
  position: absolute;
  top: 2px;
  left: 4px;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.is-saturday:not(.is-outside) .day-number { color: #456db7; }
.is-sunday:not(.is-outside) .day-number { color: #bd5560; }
.is-today .day-number { border-radius: 50%; background: var(--accent); color: #fff; box-shadow: 0 1px 5px color-mix(in srgb, var(--accent) 26%, transparent); }

.calendar-event {
  z-index: 4;
  min-width: 0;
  margin: 1px 2px 0;
  padding: 0 3px 0 4px;
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 2px;
  overflow: hidden;
  border: 0;
  border-left: 3px solid var(--role-color, var(--muted));
  border-radius: 3px;
  background: color-mix(in srgb, var(--role-color, var(--muted)) 11%, var(--surface));
  color: var(--ink);
  text-align: left;
  line-height: 1;
  cursor: pointer;
}
.calendar-event.is-continued-left { margin-left: 0; border-left-width: 1px; border-radius: 0 2px 2px 0; }
.calendar-event.is-continued-right { margin-right: 0; border-radius: 2px 0 0 2px; }
.calendar-event.is-continued-left.is-continued-right { border-radius: 0; }
.calendar-event-title {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: var(--event-font-size, 10.5px);
  font-weight: 600;
  letter-spacing: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-event-time { flex: 0 0 auto; color: color-mix(in srgb, var(--role-color, var(--muted)) 52%, var(--ink)); font-size: calc(var(--event-font-size, 10.5px) - 1.5px); font-weight: 700; font-variant-numeric: tabular-nums; }
.calendar-week.is-dense .calendar-event { margin-top: 0; margin-bottom: 0; padding-left: 3px; border-left-width: 1px; }
.calendar-week.is-ultra-dense .calendar-event { margin: 0 1px; padding-left: 2px; border-left-width: 1px; }

.calendar-event[data-span="1"] .calendar-event-title {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  line-height: 1;
  text-overflow: ellipsis;
}
.calendar-event[data-span="1"] .calendar-event-time { display: none; }
.calendar-week.is-ultra-dense .calendar-event-time { display: none; }

.calendar-loading {
  position: absolute;
  inset: 28px 0 0;
  z-index: 12;
  display: grid;
  place-items: start center;
  padding-top: 13px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255,255,255,.84), rgba(255,255,255,.26) 26%, transparent 55%);
}
.loading-panel {
  width: min(210px, calc(100% - 40px));
  padding: 9px 12px 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .96);
}
.loading-label { display: block; margin-bottom: 6px; color: var(--ink); font-size: 10px; font-weight: 700; text-align: center; }
.loading-track { height: 2px; display: block; overflow: hidden; background: var(--line); }
.loading-track i { display: block; width: 42%; height: 100%; background: var(--accent); animation: loading-slide 1s ease-in-out infinite; }
@keyframes loading-slide { 0% { transform: translateX(-120%); } 50% { transform: translateX(95%); } 100% { transform: translateX(240%); } }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.memo-sheet { position: relative; background: var(--surface); }
.memo-header {
  position: relative;
  min-height: 56px;
  padding: 0 6px 0 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.memo-header h2 { min-width: 0; grid-column: 1; margin: 0; font-size: 17px; font-weight: 700; text-align: left; }
.memo-header .memo-header-actions { grid-column: 2; }
.memo-header.is-editing { grid-template-columns: 44px minmax(0, 1fr) auto; padding-left: 6px; }
.memo-header.is-editing .memo-back-button { grid-column: 1; }
.memo-header.is-editing h2 { grid-column: 2; }
.memo-header.is-editing .memo-header-actions { grid-column: 3; }
.memo-header [hidden] { display: none !important; }
.memo-back-button, .memo-more-button {
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
}
.memo-back-button svg, .memo-more-button svg { width: 20px; height: 20px; }
.memo-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0; }
.memo-header-save {
  min-width: 52px;
  height: 44px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-size: 15px;
  font-weight: 600;
}
.memo-editor-menu {
  position: absolute;
  z-index: 5;
  top: 50px;
  right: 50px;
  width: 152px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 14px 38px rgba(0,0,0,.14);
}
.memo-editor-menu button {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}
.memo-editor-menu button + button { border-top: 1px solid var(--line); }
.memo-editor-menu .danger-menu-item { color: var(--danger); }
.memo-body { padding: 0 18px calc(88px + var(--safe-bottom)); background: var(--surface); }
.memo-list-view { min-height: 100%; }
.memo-error { min-height: 0; margin: 10px 0 0; }
.memo-error:empty { display: none; }
.memo-list { display: grid; }
.memo-item {
  width: 100%;
  min-width: 0;
  padding: 17px 0 16px;
  display: grid;
  gap: 6px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.memo-item-head { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 14px; }
.memo-item-head strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.memo-item-head time { color: var(--faint); font-size: 11px; font-weight: 500; white-space: nowrap; }
.memo-item-preview {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.memo-empty { margin: 0; padding: 64px 0; color: var(--muted); font-size: 14px; text-align: center; }
.memo-editor { min-height: 100%; padding-top: 14px; }
.memo-editor textarea {
  width: 100%;
  min-height: 52svh;
  padding: 0;
  border: 0;
  background: transparent;
  outline: 0;
  resize: none;
  color: var(--ink);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.65;
}
.memo-editor textarea::placeholder { color: var(--faint); }
.memo-editor-meta { margin: 18px 0 0; color: var(--faint); font-size: 11px; line-height: 1.4; }
.memo-floating-add { position: absolute; }

.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(20, 20, 20, .43); backdrop-filter: blur(2px); }
.sheet { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; }
.sheet-panel {
  width: 100%;
  max-height: calc(100svh - max(var(--safe-top), 10px));
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  overflow: hidden;
  border-top: 1px solid var(--ink);
  background: var(--surface);
  box-shadow: 0 -18px 55px rgba(0, 0, 0, .17);
}
.sheet-full { height: calc(100svh - max(var(--safe-top), 0px)); max-height: none; }
.sheet-tall { height: min(88svh, 760px); }
.compact-sheet { max-height: 520px; }
.menu-sheet { max-height: 460px; }
.sheet-header {
  min-height: 54px;
  padding: 0 10px;
  display: grid;
  grid-template-columns: minmax(80px, 1fr) minmax(0, 1.3fr) minmax(80px, 1fr);
  align-items: center;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.sheet-header h2 { margin: 0; overflow: hidden; font-size: 13px; font-weight: 700; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.sheet-save { min-height: 44px; padding: 0 4px; justify-self: end; border: 0; background: transparent; color: var(--accent-dark); font-size: 11px; font-weight: 700; }
.sheet-close-icon { width: 44px; height: 44px; display: grid; place-items: center; justify-self: end; border: 0; background: transparent; }
.sheet-close-icon svg { width: 19px; height: 19px; }
.sheet-body { flex: 1 1 auto; padding: 18px 16px calc(24px + var(--safe-bottom)); overflow: auto; overscroll-behavior: contain; }
.sheet-footer { flex: 0 0 auto; padding: 10px 16px calc(10px + var(--safe-bottom)); border-top: 1px solid var(--line); background: var(--surface); }

.form-block { margin: 0; padding: 16px 0 5px; border-bottom: 1px solid var(--line); }
.form-block:first-child { padding-top: 2px; }
.form-block:last-of-type { border-bottom: 0; }
.block-label { margin: 0 0 11px; color: var(--ink); font-size: 10px; font-weight: 700; letter-spacing: normal; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field > span { color: var(--muted); font-size: 9px; font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-2);
  outline: none;
}
.field input, .field select { height: 46px; padding: 0 11px; font-size: 16px; }
.field textarea { min-height: 98px; padding: 10px 11px; resize: vertical; font-size: 16px; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(10, 132, 255, .14); }
.title-field input { height: 58px; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; background: transparent; padding: 0 1px; font-size: 21px; font-weight: 700; letter-spacing: normal; }
.title-field input:focus { border-color: var(--accent); box-shadow: none; }

.event-editor-body { padding-top: 14px; }
.event-editor-body .block-label { margin-bottom: 8px; font-size: 12px; }
.event-editor-body .title-field > span { font-size: 11px; }
.editor-list { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.editor-row {
  min-height: 54px;
  padding: 0 2px;
  display: grid;
  grid-template-columns: minmax(74px, .72fr) minmax(0, 1.28fr);
  align-items: center;
  gap: 12px;
}
.editor-row + .editor-row { border-top: 1px solid var(--line); }
.editor-row-label { font-size: 14px; font-weight: 600; line-height: 1.2; }
.editor-value {
  width: 100%;
  min-width: 0;
  height: 52px;
  margin: 0;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  outline: 0;
  font-size: 16px;
  font-weight: 500;
  text-align: right;
  box-shadow: none;
}
.editor-value:focus { box-shadow: none; }
.editor-date, .editor-time { -webkit-appearance: none; appearance: none; }
.editor-date::-webkit-date-and-time-value, .editor-time::-webkit-date-and-time-value { min-height: 1.2em; text-align: right; }
.editor-date::-webkit-calendar-picker-indicator, .editor-time::-webkit-calendar-picker-indicator { margin-left: 6px; opacity: .48; }
.switch-control { position: relative; justify-self: end; width: 46px; height: 28px; }
.switch-control input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch-control i { position: absolute; inset: 0; border-radius: 999px; background: #c8c2b9; transition: background .15s ease; }
.switch-control i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.22); transition: transform .15s ease; }
.switch-control input:checked + i { background: var(--accent); }
.switch-control input:checked + i::after { transform: translateX(18px); }
.switch-control input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.event-details-block { padding-top: 16px; }
.event-details-block .editor-list { border-top: 0; }
.editor-category-row { grid-template-columns: 92px minmax(0, 1fr); }
.editor-select-wrap {
  position: relative;
  min-width: 0;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.editor-select-display {
  min-width: 0;
  width: 100%;
  padding-right: 24px;
  overflow: hidden;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-select-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}
.editor-select-wrap:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.editor-select-wrap svg { position: absolute; right: 0; width: 18px; height: 18px; pointer-events: none; color: var(--muted); }
.editor-note { display: grid; gap: 8px; margin-top: 16px; }
.editor-note > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.editor-note textarea {
  width: 100%;
  min-height: 124px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  outline: none;
  resize: vertical;
  font-size: 16px;
  line-height: 1.5;
}
.editor-note textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(10, 132, 255, .12); }
.form-message { min-height: 18px; margin: 2px 0 10px; color: var(--danger); font-size: 10px; font-weight: 600; line-height: 1.5; }
.editor-actions { display: grid; grid-template-columns: 1fr; gap: 0; margin-top: 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.editor-actions .secondary-button, .editor-actions .danger-button { min-height: 52px; border: 0; border-radius: 0; background: transparent; font-size: 14px; }
.editor-actions .danger-button { border-top: 1px solid var(--line); color: var(--danger); }
.primary-button, .secondary-button, .danger-button { min-height: 46px; padding: 0 14px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.primary-button { width: 100%; border: 1px solid var(--ink); background: var(--ink); color: #fff; }
.secondary-button { width: 100%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.danger-button { width: 100%; border: 1px solid #dfb7b9; background: #fff5f3; color: var(--danger); }
.text-button { min-height: 40px; padding: 0 4px; border: 0; background: transparent; color: var(--accent-dark); font-size: 10px; font-weight: 700; }
.month-picker-sheet { max-height: min(520px, 72svh); }
.month-picker-body { padding: 18px 18px calc(22px + var(--safe-bottom)); }
.month-picker-year-nav {
  height: 52px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  margin-bottom: 12px;
}
.month-picker-year-nav button {
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
}
.month-picker-year-nav button svg { width: 20px; height: 20px; }
.month-picker-year-nav strong { font-size: 22px; font-weight: 700; text-align: center; }
.month-picker-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.month-picker-grid button {
  position: relative;
  min-height: 48px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 15px;
  font-weight: 600;
}
.month-picker-grid button.is-selected { border-color: var(--accent); background: var(--accent); color: #fff; }
.month-picker-grid button.is-current:not(.is-selected)::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(-50%);
}
.month-picker-today {
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 700;
}


.inline-form { display: grid; gap: 2px; }
.import-summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid var(--ink); color: var(--muted); font-size: 10px; font-weight: 700; }
.import-item { padding: 12px 0; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; border-bottom: 1px solid var(--line); }
.import-item > input { width: 19px; height: 19px; margin-top: 8px; accent-color: var(--accent); }
.import-main { min-width: 0; }
.import-main .import-title { width: 100%; height: 40px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 5px; background: #fff; font-size: 16px; font-weight: 700; }
.import-meta { display: block; margin: 6px 0; color: var(--muted); font-size: 9px; }
.import-role { height: 36px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 5px; background: #fff; font-size: 16px; }

.category-sheet { position: relative; }
.category-header {
  grid-template-columns: minmax(0, 1fr) auto !important;
  padding: 0 6px 0 18px !important;
}
.category-header > h2 {
  min-width: 0;
  grid-column: 1;
  text-align: left !important;
  font-size: 17px !important;
}
.category-header .category-header-actions { grid-column: 2; }
.category-header.is-editing {
  grid-template-columns: 44px minmax(0, 1fr) auto !important;
  padding-left: 6px !important;
}
.category-header.is-editing .category-back-button { grid-column: 1; }
.category-header.is-editing > h2 { grid-column: 2; }
.category-header.is-editing .category-header-actions { grid-column: 3; }
.category-header [hidden] { display: none !important; }
.category-back-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
}
.category-back-button svg { width: 20px; height: 20px; }
.category-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0; }
.category-save-button {
  min-width: 52px;
  height: 44px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 700;
}
.category-body { padding: 0 18px calc(84px + var(--safe-bottom)); }
.category-list { display: grid; }
.category-row {
  width: 100%;
  min-height: 64px;
  padding: 0 2px;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) 24px;
  gap: 12px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.category-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--category-color); }
.category-name { min-width: 0; overflow: hidden; font-size: 16px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.category-chevron { width: 18px; height: 18px; color: var(--faint); }
.category-floating-add { bottom: calc(18px + var(--safe-bottom)); }
.category-editor { display: grid; gap: 26px; padding: 22px 0 0; }
.category-name-field { display: grid; gap: 8px; }
.category-name-field > span,
.category-color-fieldset legend,
.category-order > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.category-name-field input {
  width: 100%;
  height: 50px;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  outline: 0;
  font-size: 20px;
  font-weight: 600;
}
.category-name-field input:focus { border-bottom-color: var(--accent); }
.category-color-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.category-color-fieldset legend { margin-bottom: 12px; padding: 0; }
.category-color-palette { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.category-color-palette > button {
  position: relative;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--swatch);
}
.category-color-palette > button.is-selected::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.category-custom-color {
  width: 58px;
  display: grid;
  justify-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}
.category-custom-color input {
  width: 42px;
  height: 42px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  overflow: hidden;
}
.category-custom-color input::-webkit-color-swatch-wrapper { padding: 0; }
.category-custom-color input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.category-order { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 4px; border-top: 1px solid var(--line); }
.category-order > div { display: flex; gap: 8px; }
.category-order button {
  min-width: 62px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
}
.category-order button:disabled { opacity: .3; }
.category-delete-button {
  min-height: 46px;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

.menu-list { padding: 2px 16px 8px; }
.menu-list button { width: 100%; min-height: 66px; padding: 0 2px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.menu-list button > span { min-width: 0; }
.menu-list button b { display: block; font-size: 12px; font-weight: 700; }
.menu-list button small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.menu-list button > svg { flex: 0 0 auto; width: 18px; height: 18px; color: var(--faint); }

.toast { position: fixed; z-index: 120; left: 50%; bottom: calc(18px + var(--safe-bottom)); width: min(calc(100% - 28px), 480px); padding: 11px 14px; border: 1px solid #2f3034; border-radius: 7px; background: #1c1c1e; color: #fff; box-shadow: 0 12px 32px rgba(0,0,0,.22); transform: translateX(-50%); font-size: 11px; font-weight: 600; line-height: 1.45; text-align: center; }

@media (max-width: 360px) {
  .topline { padding-left: 11px; }
  .brand { font-size: 12px; }
  .category-filter { gap: 14px; padding-inline: 10px; }
  .calendar-event { margin-left: 1px; margin-right: 1px; padding-left: 3px; }
}

@media (min-width: 700px) {
  body { padding: 0; }
  .app { max-width: 1180px; height: 100svh; height: 100dvh; min-height: 0; border-inline: 1px solid var(--line); box-shadow: none; }
  .calendar-header { top: 0; }
  .calendar-event-title { font-size: max(var(--event-font-size, 10.5px), 11px); }
  .sheet { padding: 20px; align-items: center; }
  .sheet-panel { max-width: 620px; border: 1px solid var(--ink); border-radius: 10px; }
  .sheet-full { height: min(820px, calc(100svh - 40px)); }
  .sheet-tall { height: min(760px, calc(100svh - 40px)); }
}

@media (hover: hover) and (pointer: fine) {
  .icon-button:hover, .month-nav:hover { background: var(--surface-2); }
  .today-button:hover { border-color: var(--ink); }
  .filter-tab:hover { color: var(--ink); }
  .day-cell:hover { background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
  .calendar-event:hover { background: color-mix(in srgb, var(--role-color, var(--muted)) 17%, var(--surface)); }
  .menu-list button:hover b { color: var(--accent-dark); }
  .calendar-floating-add:hover, .sheet-floating-add:hover { background: #2a2a2d; }
}

/* Typography: one UI type system across calendar, sheets and controls. */
.brand,
.month-title,
.today-button,
.filter-tab,
.connection-banner,
.weekday-row,
.day-number,
.calendar-event,
.calendar-event-title,
.calendar-event-time,
.loading-label,
.memo-item,
.memo-item time,
.memo-header,
.memo-header-save,
.memo-editor,
.memo-editor textarea,
.memo-editor-menu,
.sheet,
.sheet-header,
.sheet-header h2,
.sheet-save,
.block-label,
.field,
.field > span,
.title-field input,
.editor-row-label,
.editor-note,
.editor-note > span,
.form-message,
.primary-button,
.secondary-button,
.danger-button,
.text-button,
.import-summary,
.import-title,
.import-meta,
.import-role,
.category-name,
.category-back-button,
.category-save-button,
.category-name-field,
.category-name-field input,
.category-color-fieldset,
.category-color-palette,
.category-custom-color,
.category-order,
.category-order button,
.category-delete-button,
.month-picker-year-nav,
.month-picker-grid,
.month-picker-today,
.menu-list,
.menu-list button,
.toast,
.day-agenda-sheet,
.day-agenda-time,
.day-agenda-content,
.day-agenda-content b,
.day-agenda-content small,
.calendar-search,
.calendar-search input,
.calendar-search button,
.import-mode-tabs,
.import-mode-tabs button,
.import-text-form textarea {
  font-family: var(--font-ui);
  font-style: normal;
  letter-spacing: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

#eventModal .sheet-header h2 { font-size: 16px; }
#eventModal .sheet-save { font-size: 15px; font-weight: 600; }
#eventModal .title-field input { height: 56px; font-size: 24px; line-height: 1.2; }

/* Calendar gestures */
.calendar-board { touch-action: pan-y; }

/* Selected-day agenda */
.day-agenda-sheet { height: min(62svh, 560px); }
.day-agenda-body { padding: 0 16px calc(16px + var(--safe-bottom)); }
.day-agenda-list { display: grid; }
.day-agenda-item {
  width: 100%;
  min-height: 66px;
  padding: 10px 2px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.day-agenda-time {
  align-self: start;
  padding-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.day-agenda-content { min-width: 0; display: grid; gap: 4px; }
.day-agenda-content b { font-size: 15px; font-weight: 600; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.day-agenda-content small { color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.35; white-space: normal; overflow-wrap: anywhere; }
.day-agenda-item > svg { width: 18px; height: 18px; color: var(--faint); }
.day-agenda-empty { margin: 0; padding: 32px 0; color: var(--muted); font-size: 13px; text-align: center; }

/* Search */
.calendar-search {
  min-height: 44px;
  padding: 5px 10px 5px 12px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 7px;
  border-top: 1px solid color-mix(in srgb, var(--line) 54%, transparent);
  background: var(--surface);
}
.calendar-search > svg { width: 18px; height: 18px; color: var(--muted); }
.calendar-search input {
  width: 100%;
  height: 34px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
  font-weight: 500;
}
.calendar-search input::placeholder { color: var(--faint); }
.calendar-search button {
  width: 36px;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}
.icon-button.is-active { background: var(--accent-soft); color: var(--accent-dark); }

/* Import mode */
.import-mode-tabs {
  height: 42px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}
.import-mode-tabs button {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.import-mode-tabs button[aria-selected="true"] { color: var(--ink); font-weight: 700; }
.import-mode-tabs button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -1px;
  height: 2px;
  background: var(--ink);
}
.import-text-form textarea {
  width: 100%;
  min-height: 170px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  outline: 0;
  resize: vertical;
  font-size: 16px;
  line-height: 1.55;
}
.import-text-form textarea:focus { border-color: var(--ink); }

/* Long-press move */
.calendar-event { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.calendar-event.is-moving-source { opacity: .32; }
.calendar-moving .day-cell { cursor: copy; }
.calendar-moving .day-cell:hover { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }

/* Undo */
.toast { display: flex; align-items: center; justify-content: center; gap: 14px; }
.toast > span { min-width: 0; }
.toast > button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 3px;
  border: 0;
  background: transparent;
  color: #8fc7ff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* v17 — focused calendar/editor UI */
.brand {
  gap: 0;
  font-size: 14px;
  font-weight: 700;
}

/* The calendar toolbar keeps only search, add and menu actions. */
.top-actions { gap: 0; }

/* Event editor: one continuous surface, familiar calendar-app rows. */
.event-editor-sheet { background: var(--surface); }
.event-editor-header {
  position: relative;
  grid-template-columns: minmax(84px, 1fr) minmax(0, 1.25fr) minmax(84px, 1fr);
  min-height: 58px;
}
.event-editor-header h2 {
  font-size: 16px;
  font-weight: 700;
}
.event-editor-header .sheet-save {
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
}
.event-header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 2px;
}
.event-more-button {
  width: 38px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
}
.event-more-button svg { width: 20px; height: 20px; }
.event-editor-menu {
  position: absolute;
  z-index: 4;
  top: 50px;
  right: 10px;
  width: 138px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 14px 38px rgba(35, 30, 24, .18);
}
.event-editor-menu button {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}
.event-editor-menu button + button { border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; }
.event-editor-menu .danger-menu-item { color: var(--danger); }

.event-editor-body {
  padding: 24px 18px calc(28px + var(--safe-bottom));
}
.event-title-field {
  display: grid;
  gap: 9px;
  padding: 0 0 24px;
}
.event-title-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.event-title-field input {
  width: 100%;
  height: 54px;
  padding: 0 0 2px;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  outline: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
}
.event-title-field input::placeholder { color: #aaa8a3; }
.event-title-field input:focus { border-bottom-color: var(--ink); }

.event-editor-list {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.event-editor-row {
  min-height: 64px;
  display: grid;
  grid-template-columns: 30px minmax(74px, .7fr) minmax(0, 1.3fr);
  align-items: center;
  column-gap: 10px;
  border-bottom: 1px solid var(--line);
}
.event-editor-row:last-child { border-bottom: 0; }
.event-row-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.event-row-icon svg { width: 22px; height: 22px; stroke-width: 1.8; }
.event-row-label {
  font-size: 16px;
  font-weight: 600;
}
.event-row-value {
  width: 100%;
  min-width: 0;
  height: 62px;
  margin: 0;
  padding: 0 2px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  outline: 0;
  font-size: 17px;
  font-weight: 500;
  text-align: right;
  box-shadow: none;
}
.event-row-value:focus { box-shadow: none; }
.event-date, .event-time { -webkit-appearance: none; appearance: none; }
.event-date::-webkit-date-and-time-value,
.event-time::-webkit-date-and-time-value { min-height: 1.2em; text-align: right; }
.event-date::-webkit-calendar-picker-indicator,
.event-time::-webkit-calendar-picker-indicator { margin-left: 6px; opacity: .42; }

.event-category-row { grid-template-columns: 30px minmax(74px, .7fr) minmax(0, 1.3fr); }
.event-select-wrap {
  position: relative;
  min-width: 0;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.event-select-display {
  width: 100%;
  min-width: 0;
  padding-right: 24px;
  overflow: hidden;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.2;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-select-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}
.event-select-wrap > svg {
  position: absolute;
  right: 0;
  width: 17px;
  height: 17px;
  color: var(--faint);
  pointer-events: none;
}
.event-select-wrap:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.event-note-field {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}
.event-note-label {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
}
.event-note-label .event-row-icon { flex: 0 0 24px; }
.event-note-field textarea {
  width: 100%;
  min-height: 148px;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface-2) 58%, var(--surface));
  outline: 0;
  resize: vertical;
  font-size: 16px;
  line-height: 1.55;
}
.event-note-field textarea::placeholder { color: #aaa8a3; }
.event-note-field textarea:focus { border-color: var(--ink); }
#eventModal .form-message { margin: 8px 0 0 34px; }

/* Add menu: all creation/import entry points live under the plus button. */
.create-sheet { max-height: 500px; }
.create-menu-list button { min-height: 70px; }

@media (max-width: 360px) {
  .event-editor-body { padding-inline: 14px; }
  .event-title-field input { font-size: 25px; }
  .event-editor-row { grid-template-columns: 28px 72px minmax(0, 1fr); column-gap: 8px; }
  .event-category-row { grid-template-columns: 28px 72px minmax(0, 1fr); }
  .event-row-label { font-size: 15px; }
  .event-row-value, .event-select-display { font-size: 16px; }
}

@media (hover: hover) and (pointer: fine) {
  .event-more-button:hover,
  .event-editor-menu button:hover { background: var(--surface-2); }
}



/* v18 — consistent sheet navigation: close is always the top-right ×. */
.sheet-header.modal-header {
  grid-template-columns: minmax(0, 1fr) 44px;
  padding: 0 6px 0 16px;
}
.sheet-header.modal-header h2 {
  text-align: left;
  font-size: 15px;
  font-weight: 700;
}
.sheet-close-icon {
  color: var(--ink);
  border-radius: 50%;
}
.sheet-close-icon:active { background: var(--surface-2); }
.sheet-close-icon svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* Event editor keeps save/actions, but the rightmost control is always close. */
.event-editor-header {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 0 6px 0 16px;
}
.event-editor-header h2 { text-align: left; }
.event-header-actions { gap: 0; }
.event-header-actions .sheet-save { min-width: 48px; }
.event-header-actions .sheet-close-icon { flex: 0 0 44px; }

/* Day agenda: creation is a single floating +, never header text. */
.day-agenda-sheet { position: relative; }
.day-agenda-body { padding-bottom: calc(82px + var(--safe-bottom)); }
.sheet-floating-add {
  position: absolute;
  z-index: 3;
  right: 18px;
  bottom: calc(18px + var(--safe-bottom));
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 22px rgba(10, 132, 255, .26);
}
.sheet-floating-add svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}
.sheet-floating-add:active { transform: scale(.96); }

@media (min-width: 760px) {
  .sheet-floating-add { right: 20px; bottom: 20px; }
}


/* v22 — persistent primary footer: Calendar / Memo. */
:root { --app-tabbar-height: 64px; }
.app { padding-bottom: calc(var(--app-tabbar-height) + var(--safe-bottom)); }
.app-tabbar {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: 0;
  width: min(100%, 1180px);
  height: calc(var(--app-tabbar-height) + var(--safe-bottom));
  padding: 5px 12px var(--safe-bottom);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr);
  align-items: stretch;
  transform: translateX(-50%);
  border-top: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--accent-wash) 30%, rgba(255,255,255,.97));
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
}
.app-tab {
  min-width: 0;
  min-height: 54px;
  padding: 3px 8px 2px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
}
.app-tab svg { width: 22px; height: 22px; stroke-width: 1.8; }
.app-tab-add {
  width: 48px;
  height: 48px;
  align-self: center;
  justify-self: center;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}
.app-tab-add svg { width: 24px; height: 24px; stroke-width: 2; }
.app-tab-add:active { transform: scale(.96); }
.app-tab.is-active { color: var(--accent-dark); }
.app-tab.is-active span { font-weight: 700; }
.app-tab:active { background: var(--accent-soft); }

/* Creation lives inside the footer, so it never covers the month grid. */
.toast {
  bottom: calc(var(--app-tabbar-height) + 12px + var(--safe-bottom));
}

/* Ordinary sheets hide the app footer. Memo opened as the Memo tab keeps it. */
.modal-open .app-tabbar { display: none; }
body.memo-tab-open .app-tabbar { display: grid; z-index: 100; }
body.memo-tab-open .modal-backdrop { display: none; }
body.memo-tab-open #memoModal { bottom: calc(var(--app-tabbar-height) + var(--safe-bottom)); }
body.memo-tab-open #memoModal .sheet-panel { height: 100%; max-height: none; border-top: 0; box-shadow: none; }
body.memo-tab-open #memoModal .memo-body { padding-bottom: 88px; }
body.memo-tab-open #memoModal .memo-floating-add { bottom: 18px; }
body.memo-tab-open.memo-editing .app-tabbar { display: none; }
body.memo-tab-open.memo-editing #memoModal { bottom: 0; }

@media (min-width: 700px) {
  .app-tabbar { width: min(420px, calc(100% - 40px)); border-inline: 1px solid var(--line); border-radius: 12px 12px 0 0; }
}

/* v24 — month overview must remain readable in one screen. */
@media (max-height: 760px) and (max-width: 759px) {
  .topline { height: 40px; }
  .monthbar { min-height: 38px; }
  .month-title { min-height: 36px; font-size: 19px; }
  .category-filter { height: 31px; }
  .weekday-row { height: 22px; flex-basis: 22px; }
  :root { --app-tabbar-height: 58px; }
  .app-tab { min-height: 48px; }
  .app-tab-add { width: 44px; height: 44px; }
}
