:root {
  --nav: #7da7b1;
  --nav-2: #8fa7d7;
  --ink: #29333b;
  --muted: #6d7882;
  --line: #c8d5dc;
  --line-soft: #e6eef1;
  --paper: #f7f5ee;
  --panel: #fffdf8;
  --shade: #b9c6cb;
  --blue: #7f9fdd;
  --green: #80bd94;
  --red: #da8a91;
  --yellow: #ead07a;
  --cyan: #94d1d4;
  --lavender: #b8a7dc;
  --peach: #f3b8a9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  background:
    linear-gradient(rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0.56)),
    radial-gradient(circle at 18px 22px, rgba(125, 167, 177, 0.16) 0 1px, transparent 1.5px),
    radial-gradient(circle at 42px 48px, rgba(184, 167, 220, 0.14) 0 1px, transparent 1.5px),
    linear-gradient(135deg, #f8f5e9 0%, #eef7f3 42%, #f4eff9 100%);
  background-size: auto, 64px 64px, 70px 70px, auto;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

input,
select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 4px 8px;
  background: var(--panel);
}

.hidden {
  display: none !important;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 30px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 18px 40px rgba(95, 112, 130, 0.18);
}

.brand-mark {
  margin: 0 0 6px;
  color: #5d7fa4;
  font-size: 28px;
  font-style: italic;
  font-weight: 900;
}

.login-panel h1 {
  margin: 0 0 12px;
}

.stack {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.login-panel button,
.lesson-entry button,
.admin-form button,
.placeholder button {
  min-height: 36px;
  border: 0;
  border-radius: 4px;
  padding: 0 18px;
  background: #74a984;
  color: white;
  font-weight: 700;
}

.muted,
.hint {
  color: var(--muted);
}

.hint {
  margin-bottom: 0;
  font-size: 13px;
}

.workspace {
  min-height: 100vh;
}

@media screen and (min-width: 1181px) {
  .workspace {
    min-height: 125vh;
    zoom: 0.8;
  }

  .workspace .side-panel {
    min-height: calc(125vh - 38px);
  }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  min-height: 38px;
  background: var(--nav);
  color: white;
  box-shadow: 0 2px 8px rgba(88, 116, 128, 0.26);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 10px;
  white-space: nowrap;
}

.brand-button {
  border: 0;
  background: transparent;
  color: white;
  font-size: 22px;
  font-style: italic;
  font-weight: 900;
  line-height: 1;
}

.brand span {
  color: #f7fbfc;
  font-size: 15px;
  font-weight: 800;
}

.main-nav {
  display: flex;
  align-items: stretch;
  min-width: 0;
  overflow-x: auto;
}

.nav-item {
  min-height: 38px;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.42);
  padding: 0 11px;
  background: transparent;
  color: #f0f2f4;
  white-space: nowrap;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.22);
}

.school-name {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 10px;
  color: #f3f9ff;
  font-weight: 700;
  white-space: nowrap;
}

.school-name button {
  min-height: 28px;
  border: 0;
  background: transparent;
  color: white;
}

.view {
  padding: 26px 22px;
}

.content-narrow {
  width: min(1360px, calc(100vw - 44px));
  margin: 0 auto;
}

.section-title {
  margin: 10px 0 12px;
  font-size: 24px;
  text-decoration: underline;
}

.menu-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 48px;
}

.menu-grid.two {
  grid-template-columns: repeat(2, 330px);
}

.menu-grid.four {
  grid-template-columns: repeat(4, 1fr);
}

.menu-card {
  display: grid;
  gap: 8px;
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 14px 18px;
  background: rgba(255, 253, 248, 0.86);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 1px 3px rgba(95, 112, 130, 0.12);
}

.menu-card strong {
  margin: -14px -18px 4px;
  border-bottom: 4px solid var(--blue);
  padding: 9px 18px 8px;
  font-size: 20px;
  font-weight: 600;
}

.menu-card.green strong {
  border-bottom-color: var(--green);
}

.menu-grid.four .menu-card strong {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  height: 52px;
  white-space: nowrap;
}

.admin-panel {
  width: min(980px, 100%);
  margin-top: -20px;
}

.admin-box {
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.9);
}

.admin-box h3 {
  margin: 0;
  padding: 9px 14px;
  background: var(--nav-2);
  color: white;
  text-align: center;
}

.admin-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 8px;
}

.slot-form {
  grid-template-columns: 130px 130px auto;
}

.person-form {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}

.teacher-form {
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  align-items: center;
}

.teacher-form .inline-check {
  grid-column: span 2;
}

.teacher-form button {
  min-width: 112px;
}

.inline-check {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  font-weight: 700;
}

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

.csv-upload {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  padding: 0 10px;
  background: #f6f2ff;
  font-weight: 500;
}

.csv-upload input {
  display: none;
}

.student-search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.student-search-form input {
  min-width: 220px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}

.data-table th {
  background: #8aa7c7;
  color: white;
  font-weight: 500;
}

.data-table td,
.data-table th {
  border: 1px solid var(--line-soft);
  padding: 8px 10px;
}

.table-sort-button {
  width: 100%;
  min-height: 24px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
}

.table-sort-button.active {
  color: #fff7b8;
}

.student-status-sections {
  display: grid;
  gap: 10px;
}

.student-status-section {
  border: 1px solid var(--line);
  background: var(--panel);
}

.student-status-toggle {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #eef7f3;
  color: #264c5a;
  font: inherit;
  font-weight: 800;
  text-align: left;
}

.student-status-toggle[aria-expanded="false"] {
  border-bottom: 0;
}

.student-status-count {
  margin-left: 2px;
  color: #315b70;
}

.student-status-icon {
  flex: 0 0 auto;
  color: #315b70;
  font-size: 13px;
}

.student-status-body {
  overflow-x: auto;
}

.student-status-empty {
  margin: 0;
  padding: 12px;
  color: var(--muted);
}

.data-table td:last-child {
  width: 210px;
  text-align: center;
}

.row-actions {
  display: flex;
  gap: 5px;
  justify-content: center;
}

.delete-small.danger {
  border-color: #d69aa0;
  background: #ffeef0;
}

.role-badge,
.login-badge {
  display: inline-flex;
  justify-content: center;
  min-width: 56px;
  border-radius: 999px;
  padding: 2px 8px;
  background: #eef7f3;
  color: #315b70;
  font-weight: 700;
}

.role-badge.admin {
  background: #fff1c2;
  color: #775f16;
}

.login-badge.blocked {
  background: #ffeef0;
  color: #9a3643;
}

.closed-admin {
  align-items: start;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.closed-admin-section {
  display: grid;
  gap: 10px;
}

.closed-admin-section h4 {
  margin: 0;
  border-left: 5px solid var(--green);
  padding: 4px 8px;
  background: #eef7f3;
  font-size: 16px;
}

.closed-form {
  grid-template-columns: 150px minmax(160px, 1fr) auto;
}

.delete-small {
  min-height: 26px;
  border: 1px solid var(--line);
  background: #fff7f5;
}

.view-schedule {
  display: grid;
  grid-template-columns: 335px 470px minmax(1180px, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding: 0;
}

.side-panel {
  min-height: calc(100vh - 38px);
  background: rgba(255, 253, 248, 0.82);
  border-right: 1px solid var(--line);
}

.list-title {
  display: flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  background: #9a8cc3;
  color: white;
  font-weight: 700;
}

.teacher-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 7px 6px;
}

.teacher-buttons button {
  min-height: 28px;
  border: 1px solid #d8d5e6;
  background: #f6f2ff;
  cursor: grab;
  touch-action: pinch-zoom;
  user-select: none;
}

.teacher-buttons button:active {
  cursor: grabbing;
}

.teacher-buttons button.active {
  border-color: #7bb7c0;
  background: #dff4f7;
  font-weight: 700;
}

.student-title {
  margin-top: 0;
}

.grade-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}

.grade-column {
  min-height: 720px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.6);
}

.grade-column h3 {
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding: 2px 6px;
  background: #eef7f3;
  text-align: center;
  font-size: 13px;
}

.student-name {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  padding: 3px 8px;
  background: transparent;
  text-align: left;
}

.student-name.active {
  background: #ffe8dd;
  font-weight: 700;
}

.day-board {
  padding: 8px 0 20px;
}

.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
}

.board-toolbar h1 {
  margin: 0 0 4px;
  font-size: 20px;
}

.date-controls,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.day-note-button {
  position: relative;
  width: 30px;
  min-width: 30px;
  height: 26px;
  border: 1px solid #9fb4bd;
  border-radius: 4px;
  padding: 0;
  background: #fffdf8;
}

.day-note-button::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  width: 13px;
  height: 9px;
  border: 2px solid #8a9da6;
  border-radius: 8px;
  background: transparent;
}

.day-note-button::after {
  content: "";
  position: absolute;
  left: 17px;
  top: 16px;
  width: 7px;
  height: 5px;
  border-left: 2px solid #8a9da6;
  border-bottom: 2px solid #8a9da6;
  transform: skewX(-24deg);
}

.day-note-button.has-note {
  border-color: #6ab1b7;
  background: #dff4f7;
}

.day-note-button.has-note::before,
.day-note-button.has-note::after {
  border-color: #176b76;
}

.mini,
.toggle,
.icon-button,
.calendar-tabs button {
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 8px;
  background: #f6f2ff;
}

.toggle.active,
.calendar-tabs button.active {
  background: var(--panel);
  font-weight: 700;
}

.lesson-entry {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.quick-panel {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.selected-student {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px 12px;
  background: var(--panel);
  font-size: 20px;
  font-weight: 700;
}

.subject-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 34px;
}

.subject-strip button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 10px;
  background: var(--panel);
}

.subject-strip button.active {
  outline: 3px solid rgba(127, 159, 221, 0.34);
  font-weight: 700;
}

.subject-strip span {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 5px;
  border: 1px solid #9bb5c2;
  vertical-align: -1px;
}

.lesson-entry input,
.lesson-entry select,
.lesson-entry button {
  min-width: 0;
}

.day-schedule {
  display: grid;
  gap: 8px;
}

.slot-block {
  min-height: 70px;
  background: #b8cbd3;
  border-left: 7px solid #8fb3be;
}

.slot-block.empty-slot {
  padding-bottom: 40px;
}

.slot-block.drag-over {
  outline: 4px solid rgba(127, 159, 221, 0.62);
  outline-offset: -4px;
  background: #c8dce4;
}

.slot-block.closed-slot {
  border-left-color: #d99ba2;
  background: #d8c4c8;
}

.slot-time {
  min-height: 20px;
  padding: 1px 8px;
  background: #83aaba;
  color: white;
  font-size: 13px;
}

.closed-slot .slot-time {
  background: #b67780;
}

.closed-slot-label {
  min-height: 24px;
  padding: 4px 9px;
  background: #fff1f2;
  color: #8f4650;
  font-weight: 700;
}

.teacher-row {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 5px;
  padding: 5px;
}

.teacher-label {
  display: grid;
  place-items: center;
  min-height: 44px;
  background: #fff9ef;
  font-size: 15px;
}

.teacher-label[draggable="true"] {
  cursor: grab;
  touch-action: pinch-zoom;
  user-select: none;
}

.teacher-label[draggable="true"]:active {
  cursor: grabbing;
}

.teacher-label.has-lessons {
  background: #fff9ef;
}

.lesson-lane {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 5px;
  min-height: 44px;
}

.lesson-lane.drag-over {
  outline: 3px solid rgba(127, 159, 221, 0.5);
  background: rgba(255, 253, 248, 0.3);
}

.lesson-card {
  display: grid;
  grid-template-rows: 1fr 1fr;
  align-content: center;
  row-gap: 1px;
  min-width: 112px;
  max-width: 136px;
  min-height: 44px;
  border: 1px solid #cfd8dd;
  border-bottom: 4px solid var(--blue);
  padding: 3px 6px;
  background: var(--panel);
  cursor: grab;
  font-size: 12px;
}

.lesson-card.kind-体験 {
  border-color: #e7b8c1;
  border-bottom-color: #de8fa2;
  background: #ffe7ec;
}

.lesson-card strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.15;
}

.lesson-card span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.15;
}

.lesson-card .tag {
  display: inline-block;
  width: 10px;
  height: 13px;
  margin-right: 3px;
  border: 1px solid #a8c8d0;
  background: var(--cyan);
  vertical-align: middle;
}

.status-欠席 {
  opacity: 0.62;
  text-decoration: line-through;
}

.kind-振替 .tag {
  background: var(--yellow);
}

.kind-欠席 .tag {
  background: var(--red);
}

.kind-講習 .tag {
  background: var(--green);
}

.kind-体験 .tag {
  border-color: #e5a6b4;
}

.lesson-kind-menu {
  position: fixed;
  z-index: 90;
  display: grid;
  gap: 4px;
  min-width: 104px;
  border: 1px solid #c8d5dc;
  border-radius: 5px;
  padding: 5px;
  background: #fffdf8;
  box-shadow: 0 12px 26px rgba(95, 112, 130, 0.26);
}

.lesson-kind-menu button {
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  text-align: left;
}

.lesson-kind-menu button:hover,
.lesson-kind-menu button.active {
  border-color: #e5a6b4;
  background: #ffe7ec;
  font-weight: 700;
}

.calendar-area {
  min-width: 1180px;
  padding: 6px 10px 20px 0;
}

.student-summary-bar {
  width: calc(((100% - 14px) / 3 * 2) + 7px);
  max-width: calc(((100% - 14px) / 3 * 2) + 7px);
  margin-bottom: 6px;
}

.student-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 12px;
  background: #fff9ef;
  font-size: 18px;
}

.student-summary strong {
  font-size: 20px;
  font-weight: 500;
}

.student-summary span {
  font-size: 18px;
}

.student-summary-kana {
  color: var(--muted);
}

.parallel-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  font-size: 17px;
}

.parallel-toggle span {
  border-radius: 999px;
  padding: 2px 10px;
  background: #d8d5e6;
  color: #5d6170;
  font-weight: 700;
}

.subject-panel-title {
  display: grid;
  place-items: center;
  width: 220px;
  min-height: 34px;
  border: 0;
  border-radius: 4px;
  margin-bottom: 6px;
  background: #82b6a1;
  color: white;
  font-size: 17px;
}

.subject-panel-title.active {
  background: #6aa78e;
  box-shadow: inset 0 -3px 0 #fff1c2;
}

.subject-panel-title.stock-delete-zone {
  width: 260px;
  background: #b65c66;
  font-weight: 800;
}

.subject-panel-title.stock-delete-zone.drag-over {
  background: #9a3643;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.55);
}

.subject-panel {
  position: fixed;
  z-index: 30;
  top: 174px;
  left: 50%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: min(940px, calc(100vw - 48px));
  min-height: 112px;
  border-radius: 6px;
  padding: 22px 18px;
  background: rgba(151, 138, 191, 0.94);
  box-shadow: 0 18px 42px rgba(95, 112, 130, 0.34);
  transform: translateX(-50%);
}

.subject-panel.dragging-subject {
  opacity: 0.28;
  pointer-events: none;
}

.subject-panel .subject-panel-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 253, 248, 0.82);
  cursor: pointer;
  touch-action: auto;
}

.subject-panel .subject-panel-close::before,
.subject-panel .subject-panel-close::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 12px;
  width: 12px;
  height: 2px;
  background: #52636a;
}

.subject-panel .subject-panel-close::before {
  transform: rotate(45deg);
}

.subject-panel .subject-panel-close::after {
  transform: rotate(-45deg);
}

.subject-panel button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  border: 1px solid #d8d5e6;
  border-radius: 4px;
  padding: 4px 12px;
  background: #fffdf8;
  text-align: left;
  font-size: 15px;
  cursor: grab;
  touch-action: pinch-zoom;
  user-select: none;
}

.subject-panel button.active {
  outline: 3px solid rgba(255, 241, 194, 0.75);
}

.subject-drag-ghost {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  min-height: 30px;
  border: 1px solid #d8d5e6;
  border-radius: 4px;
  padding: 5px 14px;
  background: #fffdf8;
  color: var(--ink);
  font-size: 15px;
  box-shadow: 0 10px 24px rgba(95, 112, 130, 0.28);
}

.subject-name {
  max-width: 100px;
  line-height: 1.2;
}

.stock-title {
  min-height: 28px;
  padding: 4px 9px;
  background: #82b6a1;
  color: white;
  font-weight: 700;
}

.stock-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 52px;
  padding: 8px;
}

.stock-empty {
  color: var(--muted);
  font-size: 13px;
}

.stock-card {
  display: grid;
  min-width: 124px;
  border: 1px solid #d8cfae;
  border-left: 5px solid var(--yellow);
  border-radius: 4px;
  padding: 6px;
  background: #fff7d8;
  cursor: grab;
  font-size: 13px;
}

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

.calendar-month-controls {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  background: #f7fbfc;
}

.calendar-month-controls label {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.month-card {
  background: rgba(143, 179, 190, 0.34);
  padding: 6px;
}

.month-card:nth-child(2) {
  background: rgba(242, 205, 160, 0.32);
}

.month-card:nth-child(3) {
  background: rgba(184, 167, 220, 0.3);
}

.month-stock-window {
  display: grid;
  align-content: start;
  min-height: 118px;
  border: 1px solid #d7d7d7;
  border-radius: 5px;
  margin: -2px -3px 12px;
  padding: 6px 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.85);
}

.month-stock-window.drag-over {
  border-color: #84c795;
  background: #f3fff4;
  box-shadow:
    inset 0 0 0 2px rgba(101, 200, 140, 0.36),
    0 0 0 2px rgba(255, 255, 255, 0.8);
}

.month-stock-row {
  display: grid;
  grid-template-columns: 76px 1fr;
  align-items: center;
  min-height: 24px;
  border-bottom: 1px solid #d7d7d7;
  column-gap: 8px;
}

.month-stock-row span {
  overflow: hidden;
  color: #111;
  font-size: 15px;
  line-height: 1.2;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-stock-row strong {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-width: 0;
}

.month-stock-mark {
  display: block;
  width: 30px;
  height: 20px;
  border-radius: 6px;
  background: #05c86b;
}

.month-stock-mark.is-stock {
  border: 1px solid #9fd9ac;
  background: #c9efd0;
  cursor: grab;
}

.month-stock-mark.is-trial {
  border-color: #e5a6b4;
  background: #ffdce5;
}

.month-stock-mark.is-stock:active,
.month-stock-mark.is-stock.dragging {
  cursor: grabbing;
  opacity: 0.68;
}

.month-card h3 {
  margin: 0 0 4px;
  text-align: center;
  font-size: 16px;
  font-weight: 500;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-left: 1px solid #93aab3;
  border-top: 1px solid #93aab3;
}

.month-day,
.weekday {
  min-height: 76px;
  border-right: 1px solid #93aab3;
  border-bottom: 1px solid #93aab3;
  background: #fffdf8;
  text-align: center;
  font-size: 13px;
}

button.month-day {
  padding: 0;
  cursor: pointer;
}

.month-day.empty {
  background: #f3f1ea;
}

.day-number {
  position: relative;
  display: block;
  min-height: 19px;
  background: #7da7b1;
  color: white;
  font-size: 13px;
  line-height: 19px;
}

.month-note-mark {
  display: none;
  position: absolute;
  right: 4px;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #176b76;
}

.month-day.has-note .month-note-mark {
  display: block;
}

.day-slots {
  display: grid;
  grid-auto-rows: 14px;
}

.day-slots b {
  display: block;
  overflow: hidden;
  border-top: 1px solid #93aab3;
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
  background: #fffdf8;
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
  line-height: 14px;
  white-space: nowrap;
}

.day-slots b.student-month-lesson {
  margin: 1px 2px 0;
  border: 1px solid;
  border-radius: 2px;
  color: #111;
  font-size: 11px;
  font-weight: 700;
  line-height: 12px;
}

.day-slots b.teacher-month-count {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4c5960;
  font-size: 11px;
  font-weight: 700;
}

.day-slots b.teacher-month-count.has-count {
  background: #dff4f7;
  color: #1f6670;
}

.weekday {
  min-height: 22px;
  background: #eaf5f1;
  border: 0;
  font-weight: 700;
}

.month-day.selected {
  position: relative;
  outline: 4px solid #2f9fff;
  outline-offset: -4px;
  background: #e8f6ff;
  color: var(--ink);
  box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px rgba(47, 159, 255, 0.18);
}

.month-day.selected .day-number {
  background: #1177c8;
  color: #fff;
  font-weight: 800;
}

.month-day.selected::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 2px solid #ffd44d;
  pointer-events: none;
}

.month-day.filled {
  background: #fffdf8;
  color: var(--ink);
}

.month-day.today {
  background: #fffdf8;
}

.month-day.today .day-number {
  background: #da8a91;
  color: white;
}

.month-day.today.selected,
.month-day.selected.filled {
  background: #e8f6ff;
}

.month-day.today.selected .day-number {
  background: #1177c8;
  color: #fff;
}

.month-day.closed-day {
  background: #fff1f2;
}

.month-day.closed-day .day-number {
  background: #b67780;
}

.day-slots b.closed-slot-mark {
  background: #ffe4e7;
  color: #8f4650;
  font-weight: 700;
}

.month-day.drag-over {
  outline: 4px solid rgba(127, 159, 221, 0.62);
  outline-offset: -4px;
  background: #e4f0ff;
}

.placeholder {
  display: grid;
  place-items: start center;
  min-height: calc(100vh - 46px);
}

.placeholder .content-narrow {
  margin-top: 60px;
  border: 1px solid var(--line);
  padding: 24px;
  background: rgba(255, 253, 248, 0.86);
}

.drag-action-panel {
  position: fixed;
  z-index: 20;
  top: 180px;
  left: 920px;
  display: grid;
  gap: 12px;
  width: 176px;
  border-radius: 6px;
  padding: 16px 12px;
  background: rgba(125, 167, 177, 0.94);
  color: white;
  box-shadow: 0 14px 35px rgba(95, 112, 130, 0.32);
}

.drag-action-panel h3 {
  margin: 0 0 4px;
  text-align: center;
  font-size: 18px;
}

.drag-action {
  display: grid;
  place-items: center;
  min-height: 104px;
  border: 3px solid transparent;
  border-radius: 4px;
  padding: 8px;
  color: var(--ink);
  text-align: center;
  font-size: 18px;
  font-weight: 700;
}

.drag-action-panel[data-mode="assignment"] .action-stock,
.drag-action-panel[data-mode="assignment"] .action-transfer,
.drag-action-panel[data-mode="assignment"] .action-absent {
  display: none;
}

.drag-action span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.drag-action.drag-over {
  border-color: #fff1c2;
}

.note-modal {
  position: fixed;
  z-index: 25;
  inset: 0;
  background: rgba(45, 53, 61, 0.28);
}

.note-dialog {
  position: absolute;
  top: 92px;
  left: 500px;
  width: 360px;
  border: 1px solid #9fb4bd;
  border-radius: 6px;
  background: #fffdf8;
  box-shadow: 0 16px 40px rgba(95, 112, 130, 0.28);
}

.note-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 10px;
  background: #b8cbd3;
}

.note-dialog-head h2 {
  margin: 0;
  font-size: 15px;
}

.note-close {
  position: relative;
  width: 24px;
  min-width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
}

.note-close::before,
.note-close::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 11px;
  width: 13px;
  height: 2px;
  background: #52636a;
}

.note-close::before {
  transform: rotate(45deg);
}

.note-close::after {
  transform: rotate(-45deg);
}

.note-dialog textarea {
  width: calc(100% - 20px);
  margin: 10px;
  border: 1px solid #b8cbd3;
  border-radius: 4px;
  padding: 8px;
  resize: vertical;
  font: inherit;
}

.note-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 10px 10px;
}

.note-delete,
.note-save {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 14px;
}

.note-delete {
  background: #fff3dc;
}

.note-delete:disabled {
  opacity: 0.45;
}

.note-save {
  background: #dff4f7;
  font-weight: 700;
}

.action-stock {
  background: #eef8ef;
}

.action-transfer {
  background: #edf4ff;
}

.action-absent {
  background: #fff9ef;
}

.action-delete {
  background: #ffeef0;
}

.regular-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.regular-form {
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
}

.regular-write-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  padding: 10px;
  background: #f8fbf1;
}

.regular-write-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.regular-write-head button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #eef7f3;
  font-weight: 700;
}

.regular-write-weekdays,
.regular-write-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(42px, 1fr));
  gap: 4px;
}

.regular-write-weekdays span {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.regular-write-day,
.regular-write-empty {
  min-height: 34px;
  border: 1px solid var(--line-soft);
  background: #fffdf8;
}

.regular-write-day {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
}

.regular-write-day.has-lessons {
  background: #fff1c2;
}

.regular-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 8px;
}

.regular-day {
  border: 1px solid var(--line);
  background: #cfe1e6;
}

.regular-day h4 {
  margin: 0;
  padding: 6px;
  background: #8aa7c7;
  color: white;
  text-align: center;
  font-size: 17px;
}

.regular-row {
  display: grid;
  grid-template-columns: 118px 1fr;
  min-height: 48px;
  border-top: 1px solid var(--line);
  background: #eef7f3;
}

.regular-row strong {
  padding: 8px;
  font-size: 13px;
  white-space: nowrap;
}

.regular-row div {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
}

.regular-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  border: 1px solid var(--line);
  padding: 2px 5px;
  background: var(--panel);
  font-size: 12px;
}

.regular-chip button {
  min-height: 18px;
  border: 1px solid var(--line);
  background: #fff7f5;
}

.view-print {
  min-height: calc(100vh - 38px);
  padding: 18px;
}

.print-workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.print-controls {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 12px 28px rgba(95, 112, 130, 0.14);
}

.print-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.print-tabs button,
.print-control-grid button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #eef7f3;
  font-weight: 700;
}

.print-tabs button.active {
  border-color: #6d9e7d;
  background: #80bd94;
  color: white;
}

.print-control-grid {
  display: grid;
  gap: 10px;
}

.print-control-grid.days label {
  gap: 8px;
}

.print-control-grid input[type="range"] {
  width: 100%;
}

.print-bulk-row {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 0;
}

.print-bulk-row label,
.print-check-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  font-weight: 600;
}

.print-check-list {
  display: grid;
  gap: 5px;
  max-height: 48vh;
  overflow: auto;
  padding-right: 4px;
}

.print-check-list span {
  color: var(--muted);
  font-weight: 500;
}

.print-preview {
  display: grid;
  gap: 18px;
  justify-items: start;
  overflow: auto;
}

.print-empty {
  border: 1px dashed var(--line);
  padding: 24px;
  background: white;
  color: var(--muted);
}

.print-page {
  color: #000;
  background: white;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  box-shadow: 0 12px 34px rgba(49, 63, 73, 0.18);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.print-page-portrait {
  width: 210mm;
  height: 297mm;
  padding: 12mm 10mm;
  overflow: hidden;
}

.print-page-landscape {
  width: 297mm;
  height: 210mm;
  padding: 7mm 9mm;
  overflow: hidden;
}

.print-page-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  border-bottom: 3px double #111;
  margin-bottom: 8mm;
  padding-bottom: 1mm;
}

.print-page-head h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
}

.print-person-title {
  font-size: 20px;
}

.print-meta {
  justify-self: end;
  text-align: right;
  font-size: 13px;
  line-height: 1.5;
}

.print-month-block h2 {
  margin: 0 0 3mm;
  text-align: center;
  font-size: 18px;
}

.print-month-block h2 strong {
  font-size: 25px;
}

.print-month-weekdays {
  display: grid;
  margin-left: 23mm;
  gap: 1mm;
}

.print-month-weekdays span {
  border-radius: 7px;
  background: #ddd;
  text-align: center;
  font-size: 11px;
  line-height: 15px;
}

.print-week-block {
  display: grid;
  grid-template-columns: 23mm 1fr;
  margin-top: 2mm;
}

.print-slot-labels {
  display: grid;
  grid-template-rows: repeat(var(--print-slot-count, 5), var(--print-slot-row-height, 7mm));
  align-content: end;
  gap: 0;
  padding-top: 4mm;
}

.print-slot-labels span {
  align-self: center;
  box-sizing: border-box;
  width: 100%;
  border-radius: 7px;
  background: #e6e6e6;
  overflow: hidden;
  padding: 0 1mm;
  text-align: center;
  font-size: 9px;
  line-height: 1.25;
  white-space: nowrap;
}

.print-week-grid {
  display: grid;
}

.print-day-column {
  display: grid;
  grid-template-rows: 4mm repeat(var(--print-slot-count, 5), var(--print-slot-row-height, 7mm));
}

.print-day-number {
  border: 1px solid #111;
  border-bottom: 0;
  background: #333;
  color: white;
  text-align: center;
  font-size: 10px;
  line-height: 4mm;
}

.print-day-column.empty .print-day-number {
  border-color: transparent;
  background: transparent;
}

.print-day-column.empty .print-month-cell {
  border-color: transparent;
  background: transparent;
}

.print-month-cell {
  border-right: 1px solid #111;
  border-bottom: 1px solid #111;
  padding: 1.1mm 1mm 0;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
}

.student-print-lesson {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
  font-size: 11px;
  line-height: 1.2;
}

.student-print-lesson.fit-sm {
  font-size: 10px;
}

.student-print-lesson.fit-xs {
  font-size: 9px;
}

.student-print-lesson.fit-xxs {
  font-size: 8px;
}

.teacher-print-page .print-month-cell {
  padding: 0.8mm 0.6mm 0;
  text-align: left;
  font-size: 9px;
  white-space: normal;
}

.teacher-print-names {
  display: grid;
  gap: 0.25mm;
  line-height: 1.12;
}

.teacher-print-names span {
  display: block;
  white-space: nowrap;
}

.print-day-column:not(.empty) .print-month-cell:first-of-type {
  border-top: 1px solid #111;
}

.print-day-column:not(.empty) .print-month-cell {
  border-left: 0;
}

.print-day-column:not(.empty):first-child .print-month-cell {
  border-left: 1px solid #111;
}

.print-day-column.first-date .print-month-cell {
  border-left: 1px solid #111;
}

.student-print-note-box {
  height: 26mm;
  margin-top: 5mm;
  border: 1px solid #111;
}

.days-print-created {
  min-height: 4mm;
  margin: -2mm 0 2mm;
  text-align: right;
  font-size: 9px;
  line-height: 1.2;
}

.days-print-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5mm;
}

.days-print-column h2 {
  margin: 0 0 2.5mm;
  text-align: center;
  font-size: 16px;
}

.days-print-slot {
  margin-bottom: 2.5mm;
}

.days-print-slot h3 {
  margin: 0 0 0.7mm;
  font-size: 13px;
}

.days-print-slot-body {
  min-height: 0;
  border: 1.2px solid #111;
  background: #fff;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.days-print-slot.is-empty .days-print-slot-body {
  min-height: 11mm;
  background: #d6d6d6;
}

.days-print-teacher-row {
  display: grid;
  grid-template-columns: 17mm 1fr;
  min-height: 6.4mm;
  border-bottom: 1.2px solid #111;
  background: #eee;
  break-inside: avoid;
  page-break-inside: avoid;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.days-print-teacher-row:last-child {
  border-bottom: 0;
}

.days-print-teacher-row > strong {
  display: grid;
  place-items: center;
  border-right: 1.2px solid #111;
  background: #f7f7f7;
  font-size: 10px;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.days-print-lesson-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: #fdfdfd;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.days-print-lesson {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  min-height: 6.4mm;
  border-right: 1.2px solid #111;
  border-bottom: 1.2px solid #111;
  padding: 0.55mm 1mm;
  background: #fdfdfd;
  font-size: 8.6px;
  line-height: 1.04;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.days-print-lesson:nth-child(3n) {
  border-right: 0;
}

.days-print-lesson:nth-last-child(-n+3) {
  border-bottom: 0;
}

.days-print-lesson span,
.days-print-lesson em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.days-print-lesson em {
  grid-column: 1;
  font-style: normal;
}

.days-print-lesson small {
  grid-column: 2;
  grid-row: 2;
  align-self: end;
  padding-left: 1.6mm;
  font-size: 8.6px;
}

.days-print-memo {
  margin-top: 2mm;
  font-size: 10px;
}

.days-print-memo strong {
  display: block;
  margin-bottom: 1mm;
}

.days-print-memo div {
  min-height: 6mm;
  border: 1px solid #111;
  padding: 1mm;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@page portrait-page {
  size: A4 portrait;
  margin: 0;
}

@page landscape-page {
  size: A4 landscape;
  margin: 0;
}

@media (max-width: 1180px) {
  .app-header {
    grid-template-columns: 1fr;
  }

  .brand,
  .school-name {
    padding: 8px 10px;
  }

  .view-schedule {
    grid-template-columns: 330px 500px 1180px;
  }

  .menu-grid.two,
  .menu-grid.four {
    grid-template-columns: 1fr;
  }

  .admin-form {
    grid-template-columns: 1fr;
  }

  .person-form,
  .teacher-form {
    grid-template-columns: 1fr;
  }

  .closed-admin {
    grid-template-columns: 1fr;
  }

  .print-workspace {
    grid-template-columns: 1fr;
  }

  .print-controls {
    position: static;
  }
}

@media print {
  .app-header,
  .side-panel,
  .calendar-area,
  .lesson-entry,
  .toolbar-actions,
  .date-controls,
  .print-controls {
    display: none !important;
  }

  body {
    background: white;
  }

  .workspace,
  .view-print {
    min-height: 0;
    padding: 0;
  }

  .view:not(.view-print),
  .print-empty {
    display: none !important;
  }

  .print-workspace,
  .print-preview {
    display: block;
    overflow: visible;
  }

  .print-page {
    box-shadow: none;
    break-after: page;
    page-break-after: always;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .print-day-number {
    background: #333 !important;
    color: #fff !important;
  }

  .print-month-cell,
  .days-print-lesson,
  .days-print-teacher-row > strong {
    color: #000 !important;
  }

  .days-print-slot-body {
    border-color: #111 !important;
    background: #fff !important;
  }

  .days-print-slot.is-empty .days-print-slot-body {
    background: #d6d6d6 !important;
  }

  .days-print-teacher-row {
    border-color: #111 !important;
    background: #eee !important;
  }

  .days-print-teacher-row > strong {
    border-color: #111 !important;
    background: #f7f7f7 !important;
  }

  .days-print-lesson-grid,
  .days-print-lesson {
    border-color: #111 !important;
    background: #fdfdfd !important;
  }

  .print-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .print-page-portrait {
    page: portrait-page;
    width: 210mm;
    height: 297mm;
  }

  .print-page-landscape {
    page: landscape-page;
    width: 297mm;
    height: 210mm;
  }

  .view-schedule {
    display: block;
  }

  .day-board {
    padding: 0;
  }
}
