/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  --notebook-page-bg: #f6efe4;
  --notebook-surface-bg: #fffaf3;
  --notebook-surface-muted: #f1e5d6;
  --notebook-line-soft: #d7c8b6;
  --notebook-line-strong: #bea98f;
  --notebook-text-main: #40362d;
  --notebook-text-subtle: #7b6f63;
  --notebook-ink-link: #6a7398;
  --notebook-accent-yellow: #efd98c;
  --notebook-accent-pink: #e3c0c2;
  --notebook-accent-green: #bfd3b3;
  --notebook-page-top-space: 24px;
  --notebook-section-gap: 20px;
  --notebook-card-padding-y: 16px;
  --notebook-card-padding-x: 16px;
  --notebook-cell-padding-y: 10px;
  --notebook-cell-padding-x: 8px;
  --notebook-field-gap: 16px;
  --notebook-heading-gap-after: 12px;
}

body {
  background-color: var(--notebook-page-bg);
}

.toast-container .app-toast__body {
  font-size: 0.875rem;
}

@media (min-width: 576px) {
  .toast-container .app-toast__body {
    font-size: 1rem;
  }
}

.notebook-page {
  position: relative;
  isolation: isolate;
  background-color: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: var(--notebook-text-main);
}

.notebook-page > :not([data-role="page-motif-layer"]) {
  position: relative;
  z-index: 1;
}

.notebook-page__motif-layer {
  pointer-events: none;
  position: absolute;
  overflow: hidden;
  z-index: 0;
}

.notebook-page__motif-layer--viewport {
  top: 0;
  bottom: 0;
  left: calc(50% - 50vw);
  width: 100vw;
}

.notebook-page__motif {
  position: absolute;
  top: -24px;
  right: -78px;
  width: 308px;
  opacity: 0.4;
  z-index: 0;
}

.notebook-page__motif-image {
  display: block;
  width: 100%;
  height: auto;
}

.notebook-page--table .notebook-page__motif {
  top: -18px;
  right: -72px;
  width: 275px;
  opacity: 0.4;
}

.notebook-page--detail .notebook-page__motif,
.notebook-page--form .notebook-page__motif {
  top: -20px;
  right: -68px;
  width: 286px;
  opacity: 0.4;
}

.notebook-page--table {
  --bs-primary-rgb: 188, 204, 232;
  --bs-danger-rgb: 232, 195, 191;
  --bs-warning-rgb: 239, 217, 140;
  --bs-success-rgb: 191, 211, 179;
  --bs-info-rgb: 200, 216, 229;
  --bs-dark: var(--notebook-line-strong);
  --notebook-table-band-a: #f7f0e5;
  --notebook-table-band-b: #efe3d1;
  --notebook-table-band-c: #e8d9c3;
}

.notebook-page a:not(.btn),
.notebook-page .btn-link {
  color: var(--notebook-ink-link);
}

.notebook-page .text-muted {
  color: var(--notebook-text-subtle) !important;
}

.notebook-page .btn-outline-primary {
  color: var(--notebook-ink-link);
  border-color: var(--notebook-ink-link);
  background-color: rgba(251, 246, 238, 0.72);
}

.notebook-page .btn-outline-primary:hover,
.notebook-page .btn-outline-primary:focus,
.notebook-page .btn-outline-primary:active {
  color: var(--notebook-text-main);
  border-color: var(--notebook-ink-link);
  background-color: var(--notebook-surface-muted);
}

.notebook-page .btn-primary {
  background-color: var(--notebook-ink-link);
  border-color: var(--notebook-ink-link);
}

.notebook-page .btn-primary:hover,
.notebook-page .btn-primary:focus,
.notebook-page .btn-primary:active {
  background-color: #536383;
  border-color: #536383;
}

.notebook-page .btn-outline-secondary {
  color: var(--notebook-text-subtle);
  border-color: var(--notebook-line-strong);
}

.notebook-page .btn-outline-secondary:hover,
.notebook-page .btn-outline-secondary:focus,
.notebook-page .btn-outline-secondary:active {
  color: var(--notebook-text-main);
  background-color: var(--notebook-surface-muted);
  border-color: var(--notebook-line-strong);
}

.notebook-page .card {
  background-color: var(--notebook-surface-bg);
  border-color: var(--notebook-line-soft);
  box-shadow: none;
}

.notebook-page .card-body {
  padding: var(--notebook-card-padding-y) var(--notebook-card-padding-x);
}

.notebook-page .form-control,
.notebook-page .form-select {
  background-color: #fffdfa;
  border-color: var(--notebook-line-soft);
}

.notebook-page .form-control:focus,
.notebook-page .form-select:focus {
  border-color: var(--notebook-line-strong);
  box-shadow: 0 0 0 0.2rem rgba(201, 190, 169, 0.2);
}

.notebook-page .form-label {
  margin-bottom: 0.5rem;
}

.notebook-page--table .calendar-table {
  background-color: var(--notebook-surface-bg);
  border-color: var(--notebook-line-soft);
}

.notebook-page--table .monthly-timetable,
.notebook-page--table .annual-plan-table {
  background-color: var(--notebook-surface-bg);
  border-color: var(--notebook-line-soft);
}

.notebook-page--table .monthly-timetable th,
.notebook-page--table .monthly-timetable td,
.notebook-page--table .annual-plan-table th,
.notebook-page--table .annual-plan-table td {
  border-color: var(--notebook-line-soft);
}

.notebook-page--table .calendar-header,
.notebook-page--table .calendar-corner-header,
.notebook-page--table .calendar-row-header {
  background-color: var(--notebook-surface-muted);
  border-color: var(--notebook-line-soft);
  padding-top: 12px;
  padding-bottom: 12px;
}

.notebook-page--table .monthly-date-header,
.notebook-page--table .monthly-date-corner,
.notebook-page--table .monthly-all-row-header,
.notebook-page--table .annual-plan-table thead th {
  background-color: var(--notebook-surface-muted) !important;
  border-color: var(--notebook-line-soft);
}

.notebook-page--table .calendar-cell {
  background-color: var(--notebook-surface-bg);
  border-color: var(--notebook-line-soft);
  padding: var(--notebook-cell-padding-y) var(--notebook-cell-padding-x);
}

.notebook-page--table .calendar-cell.cell-empty {
  background-color: #fcfaf5 !important;
}

.notebook-page--table .calendar-cell.cell-event {
  background-color: var(--notebook-surface-muted) !important;
}

.notebook-page--table .monthly-cell,
.notebook-page--table .monthly-all-cell {
  background-color: var(--notebook-surface-bg);
  min-height: 4.5rem;
}

.notebook-page--table .calendar-cell.monthly-cell-outside-month,
.notebook-page--table .monthly-cell-outside-month {
  background-color: var(--notebook-table-band-a) !important;
}

.notebook-page--table .monthly-event-name {
  color: var(--notebook-text-subtle);
}

.notebook-page--table .annual-plan-table tbody td {
  background-color: var(--notebook-surface-bg);
}

.annual-plan-class-heading {
  writing-mode: vertical-rl;
  text-orientation: upright;
  vertical-align: middle;
  white-space: nowrap;
}

.annual-plan-combined-badge {
  writing-mode: vertical-rl;
  text-orientation: upright;
  white-space: nowrap;
}

.annual-plan-actions-heading,
.annual-plan-actions-cell {
  min-width: 2.75rem;
  width: 2.75rem;
}

.annual-plan-actions {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.annual-plan-date-link {
  align-items: center;
  display: inline-flex;
  flex-direction: column;
  gap: 0.125rem;
}

.annual-plan-dashboard-mobile-deadline {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

@media (min-width: 768px) {
  .annual-plan-class-heading {
    writing-mode: horizontal-tb;
  }

  .annual-plan-combined-badge {
    writing-mode: horizontal-tb;
  }

  .annual-plan-actions-heading,
  .annual-plan-actions-cell {
    min-width: 10rem;
    width: 10rem;
  }

  .annual-plan-actions {
    flex-direction: row;
    justify-content: center;
  }

  .annual-plan-date-link {
    flex-direction: row;
    gap: 0.25rem;
  }
}

.notebook-page--table .annual-plan-table .annual-plan-deadline-divider-row td {
  background-color: var(--notebook-surface-muted);
  border-bottom-color: var(--notebook-line-strong);
  border-top-color: var(--notebook-line-strong);
  color: var(--notebook-text-main);
  padding: 0.75rem 1rem;
}

.notebook-page--table .annual-plan-table .annual-plan-deadline-divider-content {
  align-items: center;
  display: inline-flex;
  gap: 0.5rem;
}

.notebook-page--table .annual-plan-table .annual-plan-deadline-divider-label {
  display: inline-block;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
}

.notebook-page--table .annual-plan-table td.annual-plan-deadline-cell {
  vertical-align: top;
  min-width: 8rem;
}

.notebook-page--table .annual-plan-table td.annual-plan-deadline-cell--overflow {
  background-color: #fff4d6 !important;
  box-shadow: inset 4px 0 0 #c97a10;
}

@media (max-width: 767.98px) {
  .notebook-page--table .annual-plan-table tbody tr[data-lesson-id] > td {
    vertical-align: middle;
  }
}

.notebook-page--table .annual-plan-deadline-label {
  font-weight: 600;
}

.notebook-page--table .annual-plan-deadline-overflow {
  margin-top: 0.35rem;
}

.notebook-page--table .annual-plan-table td.table-light,
.notebook-page--table .annual-plan-table th.table-light {
  background-color: var(--notebook-table-band-a) !important;
}

.notebook-page--table .annual-plan-table td.table-secondary,
.notebook-page--table .annual-plan-table th.table-secondary {
  background-color: var(--notebook-table-band-b) !important;
}

.notebook-page--table .annual-plan-table td.table-primary,
.notebook-page--table .annual-plan-table th.table-primary {
  background-color: var(--notebook-table-band-c) !important;
}

.notebook-page--table .day-number {
  margin-bottom: 0.2rem;
}

.notebook-page__nav {
  margin-bottom: var(--notebook-heading-gap-after);
}

.notebook-page__tabs {
  margin-bottom: var(--notebook-section-gap) !important;
}

.notebook-page .nav-tabs {
  border-bottom-color: var(--notebook-line-soft);
}

.notebook-page .nav-tabs .nav-link {
  color: var(--notebook-ink-link);
}

.notebook-page .nav-tabs .nav-link:hover,
.notebook-page .nav-tabs .nav-link:focus {
  border-color: var(--notebook-line-soft) var(--notebook-line-soft) transparent;
  background-color: rgba(251, 246, 238, 0.75);
}

.notebook-page .nav-tabs .nav-link.active {
  color: var(--notebook-text-main);
  background-color: var(--notebook-surface-bg);
  border-color: var(--notebook-line-soft) var(--notebook-line-soft) transparent;
  box-shadow: inset 0 -3px 0 0 var(--notebook-accent-yellow);
}

.notebook-page__title {
  color: var(--notebook-text-main);
}

.notebook-page__title--hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  line-height: 1.1;
}

.notebook-page__title--hero-start {
  align-items: flex-start;
  text-align: left;
}

.notebook-page__role-title {
  display: block;
  font-size: clamp(1.45rem, 1.15rem + 1vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.03em;
}

.notebook-page__context-date {
  display: block;
  color: var(--notebook-text-subtle);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
}

.slot-page-header__main {
  min-width: 0;
}

.notebook-page--detail .slot-page-header,
.notebook-page--form .notebook-page__intro {
  margin-bottom: var(--notebook-section-gap) !important;
}

.notebook-page--detail .slot-page-header .notebook-page__title--hero {
  align-items: center;
}

.notebook-page--detail .card + .card,
.notebook-page--form .card + .card {
  margin-top: var(--notebook-section-gap) !important;
}

.notebook-page--detail .mb-3,
.notebook-page--form .mb-3 {
  margin-bottom: var(--notebook-field-gap) !important;
}

.notebook-page--form .row.g-2,
.notebook-page--detail .row.g-2 {
  row-gap: var(--notebook-field-gap) !important;
}

@media (max-width: 575.98px) {
  .notebook-page__motif {
    top: -28px;
    right: -48px;
    width: 224px;
    opacity: 0.4;
  }

  .notebook-page--table .notebook-page__motif,
  .notebook-page--detail .notebook-page__motif,
  .notebook-page--form .notebook-page__motif {
    top: -26px;
    right: -44px;
    width: 211px;
    opacity: 0.4;
  }

  .notebook-page__role-title {
    font-size: 1.35rem;
  }

  .notebook-page__context-date {
    font-size: 0.88rem;
  }
}

.monthly-timetable {
  table-layout: fixed;
  width: 100%;
}

.monthly-timetable th,
.monthly-timetable td {
  vertical-align: middle;
  padding: 0.24rem 0.16rem;
}

.notebook-page--table .monthly-timetable .calendar-cell {
  padding: 1px 2px;
  font-size: 0.875rem;
  height: auto;
  min-height: 0;
}

.notebook-page--table .monthly-timetable .monthly-cell,
.notebook-page--table .monthly-timetable .monthly-all-cell {
  min-height: 0;
}

.notebook-page--table .monthly-timetable .monthly-date-header,
.notebook-page--table .monthly-timetable .monthly-all-row-header {
  padding: 1px 2px;
  font-size: 0.875rem;
  line-height: 1.05;
}

.notebook-page--table .monthly-timetable .monthly-date-cell {
  background-color: var(--notebook-surface-bg) !important;
  color: var(--notebook-text-main);
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  padding: 4px 6px;
  text-align: left;
  vertical-align: top;
}

.notebook-page--table .monthly-timetable .monthly-date-cell .text-xs {
  color: var(--notebook-text-subtle) !important;
  font-size: inherit;
}

.notebook-page--table .monthly-timetable .monthly-group-start > th,
.notebook-page--table .monthly-timetable .monthly-group-start > td {
  border-top-color: var(--notebook-line-strong);
  border-top-width: 3px;
}

.notebook-page--table .monthly-timetable .monthly-all-row-header {
  font-weight: 400;
}

.notebook-page--table .monthly-timetable .first-occurrence-cell a {
  font-weight: inherit;
}

.notebook-page--table .monthly-timetable .calendar-cell.past-cell .calendar-entry-content {
  color: var(--notebook-text-subtle);
  opacity: 0.48;
}

.notebook-page--table .monthly-timetable td.monthly-all-cell--rowspan-event {
  vertical-align: middle;
}

.notebook-page--table .monthly-timetable .monthly-all-cell--rowspan-event > div {
  display: flex !important;
  flex-direction: column;
  justify-content: center;
}

.monthly-date-header,
.monthly-date-corner {
  background-color: #f5f6f8 !important;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

.monthly-cell {
  min-height: 3rem;
  background-color: #fff;
}

.monthly-cell-outside-month {
  background-color: #fafafa;
}

.monthly-entry-name {
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.12;
  margin-bottom: 0.08rem;
  overflow-wrap: anywhere;
}

.monthly-entry-name:last-child {
  margin-bottom: 0;
}

.monthly-event-name {
  color: #5f6368;
}

.monthly-all-cell--rowspan-event {
  vertical-align: middle;
}

.monthly-entry-link {
  min-width: 0;
  overflow: hidden;
  width: 100%;
}

.calendar-entry-dropdown {
  width: 100%;
}

.calendar-entry-dropdown-toggle {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: inherit;
}

.calendar-entry-dropdown-toggle:hover,
.calendar-entry-dropdown-toggle:focus {
  color: inherit;
  text-decoration: none;
}

.calendar-entry-dropdown-toggle.dropdown-toggle::after {
  display: none;
}

.calendar-entry-dropdown .dropdown-menu {
  min-width: 9rem;
}

.calendar-entry-dropdown .button_to {
  margin: 0;
}

.calendar-entry-dropdown .dropdown-item {
  font-size: 0.875rem;
}

.chain-preview-overlay {
  color: #2563eb;
  height: 100vh;
  inset: 0;
  pointer-events: none;
  position: fixed;
  width: 100vw;
  z-index: 1054;
}

.chain-preview-overlay line {
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-width: 2;
}

/* 走る矢印（矢じり＋固定長シャフト） */
.chain-preview-overlay .chain-preview-runner polygon {
  fill: currentcolor;
}

.chain-preview-overlay .chain-preview-runner line {
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-width: 2.5;
}

/* 破線（静止）の案内線 */
.chain-preview-overlay line.chain-preview-guide {
  opacity: 0.55;
  stroke-dasharray: 6 5;
  stroke-width: 2;
}

/* 交換は2本のレーンを色でも区別する。矢印の位置もJS側で少しずらす。 */
.chain-preview-overlay .chain-preview-lane--1 {
  color: #c2410c;
}

.chain-move-clone--lane-1 {
  background: rgb(255 237 213 / 95%);
  border-color: #c2410c;
  box-shadow: 0 2px 6px rgb(194 65 12 / 35%);
}

/* 玉突きで前へ送られるコマ内容のクローン。実DOMは動かさず、これを重ねてスライドさせる */
.chain-move-clone {
  align-items: center;
  background: rgb(219 230 255 / 95%);
  border: 1.5px solid #2563eb;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgb(37 99 235 / 35%);
  box-sizing: border-box;
  color: #123;
  display: flex;
  font-size: 0.8rem;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
  position: fixed;
  transition: transform 0.35s cubic-bezier(0.34, 1.1, 0.64, 1);
  z-index: 1053;
}

.chain-preview-continuation {
  background: #1d4ed8;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgb(29 78 216 / 35%);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  pointer-events: none;
  position: fixed;
  white-space: nowrap;
  z-index: 1053;
}

/* アニメ中、実コマ内容は隠してクローン側に見せる */
.chain-preview-hidden-content {
  color: transparent !important;
}

@media (prefers-reduced-motion: reduce) {
  .chain-move-clone { transition: none; }
}

/* 移動モード中の状態トースト。結果通知トーストと違い、モード終了まで出しっぱなしにする */
.move-mode-toast-wrapper {
  z-index: 1090;
  max-width: min(34rem, calc(100vw - 1rem));
}

.move-mode-toast {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0;
  border-width: 2px;
  background-color: #c9433a !important;
  border-color: #a32e26 !important;
  color: #fff !important;
}

.move-mode-toast .btn {
  font-size: 1.1rem;
  white-space: nowrap;
  color: #fff;
  border-color: #fff;
}

.move-mode-toast .btn:hover,
.move-mode-toast .btn:focus,
.move-mode-toast .btn:active {
  color: #c9433a;
  background-color: #fff;
  border-color: #fff;
}

/* 年間タブ「授業をまとめる」選択モードのトースト。移動モード（赤）と区別する青系 */
.move-mode-toast.annual-plan-remedy-mode-banner {
  background-color: #2f6fb1 !important;
  border-color: #245a94 !important;
}

.move-mode-toast.annual-plan-remedy-mode-banner .btn:hover,
.move-mode-toast.annual-plan-remedy-mode-banner .btn:focus,
.move-mode-toast.annual-plan-remedy-mode-banner .btn:active {
  color: #2f6fb1;
}

.calendar-entry-preview-source,
.calendar-entry-preview-following {
  outline: 2px solid rgba(37, 99, 235, 0.55);
  outline-offset: 2px;
}

.calendar-entry-preview-source {
  background-color: rgba(37, 99, 235, 0.08);
}

.monthly-entry-list .text-truncate {
  max-width: 100%;
}

.slot-move-candidate {
  position: relative;
  background-color: #fff8cc;
}

.slot-move-candidate:hover,
.slot-move-candidate:focus {
  background-color: #ffe98a;
}

.slot-move-source {
  position: relative;
  display: block;
  width: 100%;
  background-color: #fff1f1 !important;
  color: #5f161d;
  border-radius: 0.375rem;
}

.slot-move-source a,
.slot-move-source .monthly-event-name {
  color: inherit;
}

@media (max-width: 767.98px) {
  .monthly-timetable th,
  .monthly-timetable td {
    padding: 0.16rem 0.08rem;
  }

  .notebook-page--table .monthly-timetable .monthly-date-cell {
    font-size: 1.35rem;
    padding: 1px 2px;
  }

  .notebook-page--table .monthly-timetable .calendar-cell {
    padding: 1px;
  }

  .notebook-page--table .monthly-timetable .monthly-cell,
  .notebook-page--table .monthly-timetable .monthly-all-cell {
    min-height: 0;
  }

  .monthly-entry-name {
    font-size: 0.62rem;
    line-height: 1.05;
  }

  .monthly-class-col {
    width: 4.1rem;
  }

  .monthly-day-col {
    width: calc((100vw - 4.1rem - 2rem) / 5);
  }

  .monthly-timetable .calendar-header {
    font-size: 0.82rem;
    padding: 0.45rem 0.15rem;
  }

  .monthly-cell {
    min-height: 2.4rem;
  }

  .notebook-page--table .monthly-cell,
  .notebook-page--table .monthly-all-cell {
    min-height: 2.4rem;
  }

  .monthly-timetable .calendar-header[style] {
    width: auto !important;
  }
}
.notebook-page--table th.today {
  background-color: #f4ead0;
  box-shadow: inset 0 -4px 0 0 var(--notebook-accent-yellow);
}

.notebook-page--table td.today,
.notebook-page--table th.today {
  outline: 0;
}

.notebook-page--table .calendar-cell.today {
  position: relative;
  box-shadow: inset -3px 0 0 0 var(--notebook-accent-yellow);
}

.notebook-page--table .weekly-timetable tbody tr:last-child .calendar-cell.today {
  box-shadow:
    inset -3px 0 0 0 var(--notebook-accent-yellow),
    inset 0 -3px 0 0 var(--notebook-accent-yellow);
}

.notebook-page--table .annual-plan-table tbody td.annual-plan-today-cell {
  box-shadow:
    inset 3px 0 0 0 var(--notebook-accent-yellow),
    inset -3px 0 0 0 var(--notebook-accent-yellow),
    inset 0 -3px 0 0 var(--notebook-accent-yellow);
}

.notebook-page--table .calendar-cell.today::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background-color: var(--notebook-accent-yellow);
  opacity: 0.9;
  pointer-events: none;
}

.first-occurrence-cell {
  box-shadow: inset 0 0 0 2px var(--bs-warning);
}

.first-occurrence-cell a {
  font-weight: 700;
}

/* 準備物リスト編集の単独画面（ページ枠） */
.lesson-material-editor-page {
  max-width: 1180px;
  padding-bottom: 2rem;
}

/* 準備物リスト編集本体。単独画面と授業を編集カード内の Turbo Frame で共用する */
.lesson-material-editor {
  --material-editor-border: #ded1bd;
  --material-editor-surface: rgba(255, 255, 255, 0.58);

  display: block;
}

.lesson-material-editor__section + .lesson-material-editor__section {
  margin-top: 1.75rem;
}

/* 追加セクションを編集セクションより上の層にする。
   .notebook-page の直下の子はすべて z-index: 1 の同格スタッキングコンテキストになるため、
   準備物検索のドロップダウン（z-index: 1050）がセクション内に閉じ込められ、
   後続の「編集する」カード（半透明背景）の下に潜って透けて見える問題への対処。
   授業を編集カード内では .notebook-page の position 指定が効かないので、
   ここで position も自分で持たせて同じ重なり順を保つ */
.lesson-material-editor .lesson-material-editor__section--add {
  position: relative;
  z-index: 2;
}

.lesson-material-editor .card {
  border-color: var(--material-editor-border);
  background: var(--material-editor-surface);
  box-shadow: 0 0.2rem 0.75rem rgba(80, 59, 35, 0.05);
}

.lesson-material-picker__form {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
}

.lesson-material-picker__field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.lesson-material-picker__combobox {
  position: relative;
}

.lesson-material-picker__query {
  padding-left: 2.45rem;
  padding-right: 2.5rem;
}

.lesson-material-picker__search-icon {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 0.75rem;
  color: #6d675f;
  pointer-events: none;
  transform: translateY(-50%);
}

.lesson-material-picker__toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 2.5rem;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #625b52;
  font-size: 1.2rem;
}

.lesson-material-picker__listbox {
  position: absolute;
  z-index: 1050;
  top: calc(100% + 0.25rem);
  right: 0;
  left: 0;
  max-height: 18rem;
  overflow-y: auto;
  border: 1px solid var(--material-editor-border);
  border-radius: 0.5rem;
  background: #fffdf9;
  box-shadow: 0 0.5rem 1.25rem rgba(70, 52, 32, 0.16);
}

.lesson-material-picker__option,
.lesson-material-picker__message {
  padding: 0.7rem 0.85rem;
}

.lesson-material-picker__option {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.lesson-material-picker__option:hover,
.lesson-material-picker__option.is-active {
  background: #eef6ee;
}

.lesson-material-picker__submit {
  flex: 0 0 auto;
}

.lesson-material-editor__list {
  overflow: hidden;
  border: 1px solid var(--material-editor-border);
  border-radius: 0.65rem;
  background: var(--material-editor-surface);
}

.lesson-material-editor__list-heading,
.lesson-material-editor__row {
  display: grid;
  grid-template-columns: minmax(12rem, 1.5fr) minmax(11rem, 1fr) minmax(10rem, 0.8fr) 3rem;
  align-items: center;
  gap: 0.75rem;
}

.lesson-material-editor__list-heading {
  padding: 0.65rem 1rem 0.3rem;
  color: #625b52;
  font-size: 0.82rem;
  font-weight: 700;
}

.lesson-material-editor__row {
  min-height: 5rem;
  padding: 0.75rem 1rem;
}

.lesson-material-editor__row + .lesson-material-editor__row {
  border-top: 1px solid var(--material-editor-border);
}

.lesson-material-editor__name {
  font-weight: 600;
}

.lesson-material-edit-field {
  min-width: 0;
}

.lesson-material-edit-field__quantity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lesson-material-edit-field__unit {
  flex: 0 0 auto;
}

.lesson-material-edit-field__status {
  min-height: 1.2em;
  margin-top: 0.2rem;
  color: #64705f;
}

.lesson-material-editor__delete {
  position: relative;
  justify-self: end;
}

.lesson-material-editor__delete-button {
  padding: 0.5rem;
}

.lesson-material-editor__delete-confirmation {
  white-space: nowrap;
}

@media (max-width: 767.98px) {
  .lesson-material-editor-page {
    margin-top: 1rem;
  }

  .lesson-material-picker__form {
    align-items: stretch;
    flex-direction: column;
  }

  .lesson-material-picker__submit {
    align-self: flex-start;
  }

  .lesson-material-editor__list-heading {
    display: none;
  }

  .lesson-material-editor__row {
    grid-template-columns: minmax(0, 1fr) 2.75rem;
    gap: 0.65rem;
    padding: 1rem;
  }

  .lesson-material-editor__name {
    grid-column: 1;
  }

  .lesson-material-editor__type,
  .lesson-material-editor__quantity {
    grid-column: 1 / -1;
  }

  .lesson-material-editor__delete {
    grid-column: 2;
    grid-row: 1;
  }

  .lesson-material-editor__delete-confirmation {
    position: absolute;
    right: 1.5rem;
    padding: 0.4rem;
    border: 1px solid var(--material-editor-border);
    border-radius: 0.4rem;
    background: #fffdf9;
    box-shadow: 0 0.25rem 0.75rem rgba(70, 52, 32, 0.12);
  }
}

/* セットアップ: 時間割コマ選択の「押せる/押せない/選択中」を見た目で分ける */
.notebook-page .setup-weekly-timetable td {
  padding: 0;
}

.notebook-page .setup-weekly-timetable .setup-slot-cell__tap {
  display: block;
  margin: 0;
  padding: 12px 8px;
  cursor: pointer;
}

.notebook-page .setup-weekly-timetable .setup-slot-cell:has(.form-check-input:checked) {
  background-color: #cfe8ff;
}

.notebook-page .setup-weekly-timetable .setup-slot-cell--occupied {
  padding: 12px 4px;
  background-color: #e9ecef;
  color: #6c757d;
  font-size: 0.75rem;
}

/* セットアップ: 学級選択の行を押しやすくし、選択中をハイライトする */
.notebook-page .setup-class-choice {
  padding: 8px 12px 8px 36px;
  border-radius: 8px;
}

.notebook-page .setup-class-choice:has(.form-check-input:checked) {
  background-color: #cfe8ff;
}

.notebook-page .setup-class-choice .form-check-label {
  display: block;
  cursor: pointer;
}

/* 年間タブ: 終わった授業の折りたたみトグル行 */
.notebook-page .annual-plan-table .annual-plan-past-toggle {
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background-color: #f1f0ec;
  color: #495057;
  font-weight: 600;
}
