/* ============================================================
   スケジュールチェッカー - スタイル
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* hidden 属性は UA スタイル(display:none)が作者スタイルの display:flex/grid に負けるため明示的に勝たせる */
[hidden] {
  display: none !important;
}

/* 空のときは描画しない（aria-live 要素は DOM に常駐させ、中身の有無で表示を切り替える） */
.toast:empty,
.alert:empty {
  display: none;
}

:root {
  color-scheme: light dark;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f7;
  --border: #e3e8ef;
  --border-strong: #c9d2de;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #e0ebff;
  --primary-text: #1e40af;
  --on-primary: #ffffff;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warn-bg: #fff7e0;
  --warn-border: #f1d282;
  --warn-text: #8a5a00;
  --success: #16a34a;
  --focus: #93c5fd;
  --toast-bg: #1f2937;
  --toast-text: #ffffff;
  --toast-action: #93c5fd;
  --sun: #e11d48;
  --sat: #2563eb;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.05), 0 8px 24px rgba(17, 24, 39, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141c;
    --surface: #161d28;
    --surface-2: #1b2431;
    --surface-3: #232e3d;
    --border: #2a3545;
    --border-strong: #3b4859;
    --text: #e6eaf0;
    --text-2: #cfd6e0;
    --muted: #8b96a5;
    --primary: #4f8ff7;
    --primary-hover: #6da3ff;
    --primary-soft: #1b2d4f;
    --primary-text: #bcd4ff;
    --danger: #f87171;
    --danger-soft: #3b1414;
    --warn-bg: #3a2e10;
    --warn-border: #7a5d14;
    --warn-text: #f5d78e;
    --success: #4ade80;
    --focus: #3b82f6;
    --toast-bg: #e5e7eb;
    --toast-text: #111827;
    --toast-action: #1d4ed8;
    --sun: #fb7185;
    --sat: #7db0ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

html {
  font-family: var(--font);
  font-size: 15px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3 {
  margin: 0;
  line-height: 1.3;
}

button {
  font: inherit;
}

/* ------------------------------------------------------------ header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px 20px;
  padding: 10px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-actions {
  margin-left: auto;
}

@media (max-width: 700px) {
  .app-header {
    flex-wrap: wrap;
    gap: 6px 12px;
    padding: 8px 12px;
  }
  .app-header .site-nav {
    order: 3;
    width: 100%;
    margin-left: -6px;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 1.35rem;
}

.brand h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.storage-warning {
  padding: 8px 16px;
  text-align: center;
  font-size: 0.9rem;
  background: var(--warn-bg);
  color: var(--warn-text);
  border-bottom: 1px solid var(--warn-border);
}

/* ------------------------------------------------------------ layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel-form {
  position: sticky;
  top: 72px;
  align-self: start;
  border-top: 4px solid var(--primary);
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.app-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 8px 16px 28px;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 14px 12px 32px;
  }
  .panel-form {
    position: static;
  }
  .panel {
    padding: 16px;
  }
}

/* ------------------------------------------------------------ form */
.field {
  margin-bottom: 12px;
}

.field > label,
.field > .label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
}

.req {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 999px;
  vertical-align: middle;
}

.opt {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
}

.field input[type="text"],
.field input[type="date"],
.field input[type="time"],
.field select,
.field textarea,
.date-nav input[type="date"] {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.4;
}

.field textarea {
  resize: vertical;
  min-height: 54px;
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible,
.date-nav input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--primary);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-check {
  align-self: end;
}

.field-check label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.field-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: -4px 0 12px;
}

.chips-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-right: 2px;
}

.chip {
  padding: 3px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.8rem;
  cursor: pointer;
}

.chip:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-text);
}

.color-picker {
  display: flex;
  gap: 10px;
  padding: 2px 0;
}

.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--swatch);
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s ease;
}

.color-swatch:hover {
  transform: scale(1.08);
}

.color-swatch.active {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--swatch);
}

.alert {
  margin: 4px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  line-height: 1.5;
}

.alert ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.alert p {
  margin: 6px 0 0;
  font-size: 0.82rem;
  opacity: 0.9;
}

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
}

.alert-warn {
  background: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid var(--warn-border);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.form-actions .btn-lg {
  flex: 1;
}

#event-form.is-editing .form-actions .btn-primary {
  background: var(--success);
  border-color: var(--success);
}

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn:hover {
  background: var(--surface-3);
}

.btn:focus-visible,
.chip:focus-visible,
.color-swatch:focus-visible,
.icon-btn:focus-visible,
.day-cell:focus-visible,
.segmented button:focus-visible,
.group-head:focus-visible,
.mg-chip:focus-visible,
.mg-day:focus-visible,
.toast-action:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-lg {
  padding: 11px 16px;
  font-size: 1rem;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.84rem;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--surface-3);
}

.btn-icon {
  padding: 9px 12px;
  font-size: 1.1rem;
  line-height: 1;
}

.btn-danger-outline {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  background: transparent;
}

.btn-danger-outline:hover {
  background: var(--danger-soft);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ------------------------------------------------------------ date nav */
.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.date-nav input[type="date"] {
  width: auto;
  min-width: 150px;
  padding: 8px 10px;
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.day-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 7px 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.day-cell:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.day-cell .dow {
  font-size: 0.72rem;
  color: var(--muted);
}

.day-cell.sun .dow {
  color: var(--sun);
}

.day-cell.sat .dow {
  color: var(--sat);
}

.day-cell .dnum {
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.2;
}

.day-cell .dots {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 10px;
}

.day-cell .dots i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
}

.day-cell .dots .count {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.day-cell.today {
  border-color: var(--primary);
}

.day-cell.today .dnum {
  color: var(--primary);
}

.day-cell.selected,
.day-cell.selected:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.day-cell.selected .dow,
.day-cell.selected .dnum,
.day-cell.selected .dots .count {
  color: var(--on-primary);
}

.day-cell.selected .dots i {
  background: var(--on-primary);
}

.date-heading {
  margin: 16px 0 2px;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.summary strong {
  color: var(--text);
  font-weight: 700;
}

/* ------------------------------------------------------------ sub panels */
.sub-panel {
  margin-top: 18px;
}

.sub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.sub-head h3 {
  font-size: 1rem;
  font-weight: 700;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

fieldset .hint {
  margin: 0 0 10px;
  line-height: 1.5;
}

.empty {
  margin: 0;
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  list-style: none;
}

/* ------------------------------------------------------------ free slots */
.slot-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.slot.past {
  opacity: 0.55;
  border-left-color: var(--muted);
}

.slot-time {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
}

.slot-range {
  font-weight: 700;
  font-size: 1.02rem;
  font-variant-numeric: tabular-nums;
}

.slot-range .sep {
  color: var(--muted);
  font-weight: 400;
}

.slot-dur {
  color: var(--muted);
  font-size: 0.84rem;
}

/* ------------------------------------------------------------ event list */
.segmented {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
}

.segmented button {
  border: none;
  background: transparent;
  padding: 5px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.segmented button.active {
  background: var(--primary);
  color: var(--on-primary);
}

.event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.event {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 10px 10px 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--ev-color, var(--primary));
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.event.editing {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.event-time {
  display: flex;
  flex-direction: column;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  padding-top: 1px;
}

.event-time-end {
  font-weight: 400;
  font-size: 0.82rem;
  color: var(--muted);
}

.event.all-day .event-time {
  color: var(--ev-color, var(--primary));
  font-size: 0.9rem;
}

.event-body {
  min-width: 0;
}

.event-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.event-memo {
  margin-top: 2px;
  font-size: 0.84rem;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.event-actions {
  display: flex;
  gap: 2px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.icon-btn.icon-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.5;
  vertical-align: middle;
}

.badge-warn {
  background: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid var(--warn-border);
}

.badge-today {
  background: var(--primary-soft);
  color: var(--primary-text);
}

.event-group {
  margin-bottom: 16px;
}

.group-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  margin-bottom: 8px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.group-head:hover {
  color: var(--primary);
}

.group-count {
  margin-left: auto;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.84rem;
}

.event-group.past {
  opacity: 0.7;
}

.event-group.selected .group-head {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ------------------------------------------------------------ dialog */
dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  width: min(520px, calc(100% - 32px));
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

dialog form {
  padding: 22px;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px 6px;
  margin: 0 0 14px;
  min-width: 0;
}

legend {
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0 6px;
}

/* ------------------------------------------------------------ toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--toast-bg);
  color: var(--toast-text);
  font-size: 0.92rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  animation: toast-in 0.18s ease-out;
}

.toast-error {
  background: var(--danger);
  color: #fff;
}

.toast-action {
  border: none;
  background: transparent;
  color: var(--toast-action);
  font-weight: 700;
  cursor: pointer;
  padding: 2px 4px;
  white-space: nowrap;
}

.toast-error .toast-action {
  color: #fff;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ------------------------------------------------------------ small screens */
@media (max-width: 600px) {
  html {
    font-size: 14.5px;
  }
  .brand h1 {
    font-size: 1rem;
  }
  .event {
    grid-template-columns: 52px minmax(0, 1fr) auto;
  }
  .slot {
    flex-direction: column;
    align-items: stretch;
  }
  .slot .btn {
    width: 100%;
  }
  .date-nav input[type="date"] {
    min-width: 0;
    flex: 1;
  }
}

/* ------------------------------------------------------------ calendar (week/month switch) */
.date-nav {
  flex-wrap: wrap;
}

.view-toggle {
  margin-left: auto;
}

.cal-title {
  margin: 2px 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-2);
}

.cal-title:empty {
  display: none;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.mg-dow {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  padding: 2px 0 4px;
}

.mg-dow.sun {
  color: var(--sun);
}

.mg-dow.sat {
  color: var(--sat);
}

.mg-cell {
  min-height: 86px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.mg-cell:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.mg-cell.other {
  opacity: 0.45;
}

.mg-cell.selected,
.mg-cell.selected:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
  opacity: 1;
}

.mg-day {
  align-self: flex-start;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mg-cell.sun .mg-day {
  color: var(--sun);
}

.mg-cell.sat .mg-day {
  color: var(--sat);
}

.mg-cell.today .mg-day {
  background: var(--primary);
  color: var(--on-primary);
}

.mg-chips {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mg-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
  padding: 1px 4px 1px 5px;
  border: none;
  border-left: 3px solid var(--chip);
  border-radius: 4px;
  background: color-mix(in srgb, var(--chip) 16%, transparent);
  color: var(--text);
  font-size: 0.72rem;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
}

.mg-chip:hover {
  background: color-mix(in srgb, var(--chip) 32%, transparent);
}

.mg-chip-time {
  flex: none;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.mg-chip-title {
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.mg-more {
  padding-left: 4px;
  font-size: 0.7rem;
  color: var(--muted);
}

.mg-dots {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  margin-top: auto;
  min-height: 8px;
}

.mg-dots i {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.mg-dots span {
  font-size: 0.62rem;
  color: var(--muted);
  line-height: 1;
}

@media (max-width: 600px) {
  .month-grid {
    gap: 3px;
  }
  .mg-cell {
    min-height: 54px;
    padding: 3px 2px;
    border-radius: 6px;
  }
  .mg-day {
    width: 22px;
    height: 22px;
    font-size: 0.8rem;
  }
  .mg-chips {
    display: none;
  }
  .mg-dots {
    display: flex;
  }
  .view-toggle {
    margin-left: 0;
  }
}

/* ------------------------------------------------------------ banners / day actions */
.welcome-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.5;
}

.welcome-text {
  flex: 1 1 260px;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.welcome-actions .btn {
  text-decoration: none;
}

.import-banner {
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.5;
}

.import-msg {
  font-weight: 600;
}

.import-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 8px;
}

.import-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}

.import-date input {
  padding: 5px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 16px;
}

.day-head .date-heading {
  margin: 0;
}

.day-actions {
  display: flex;
  gap: 6px;
}

.icon-link {
  text-decoration: none;
  font-weight: 800;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.icon-link:hover {
  color: #188038;
  background: var(--surface-3);
}

/* ------------------------------------------------------------ 予定ダイアログ / 繰り返し / FAB */
.event-dialog {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.event-dialog form {
  padding: 20px 22px 22px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.dialog-head .panel-title {
  margin-bottom: 0;
}

.field-hint {
  margin: -6px 0 12px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}

.badge-repeat {
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--border);
  font-size: 0.72rem;
}

.series-actions {
  flex-wrap: wrap;
}

#series-msg {
  margin: 0 0 6px;
  line-height: 1.6;
}

.fab {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 30;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 1.9rem;
  line-height: 1;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
  cursor: pointer;
  display: none;
}

.fab:hover {
  background: var(--primary-hover);
}

@media (max-width: 700px) {
  .fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .event-dialog {
    width: calc(100% - 16px);
    max-height: calc(100vh - 16px);
  }
  .event-dialog form {
    padding: 16px;
  }
}

/* ------------------------------------------------------------ print (選択日の予定表を印刷) */
@media print {
  .app-header,
  .panel-form,
  .intro,
  .site-footer,
  .app-footer,
  .ad-slot,
  .toast,
  .date-nav,
  .cal-title,
  .week-strip,
  .month-grid,
  .welcome-banner,
  .import-banner,
  .day-actions,
  .event-actions,
  .btn-add-slot,
  .segmented,
  .storage-warning,
  dialog {
    display: none !important;
  }
  html {
    font-size: 12pt;
  }
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .layout {
    display: block;
    max-width: none;
    padding: 0;
  }
  .panel {
    border: none;
    box-shadow: none;
    padding: 0;
    background: #fff;
  }
  .day-head {
    margin-top: 0;
  }
  .date-heading {
    font-size: 16pt;
  }
  .sub-panel {
    margin-top: 14px;
  }
  .slot,
  .event {
    break-inside: avoid;
    border-color: #999 !important;
    background: #fff !important;
  }
  .event {
    grid-template-columns: 70px 1fr;
  }
  .badge-today {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
