:root {
  --paper: #f5efe2;
  --paper-deep: #e9dfca;
  --card: #fffaf0;
  --card-strong: #fffdf7;
  --ink: #1f2926;
  --ink-soft: #58615b;
  --line: rgba(43, 52, 47, 0.16);
  --line-strong: rgba(43, 52, 47, 0.28);
  --red: #a9362c;
  --red-deep: #7f211c;
  --green: #29473c;
  --green-light: #dfe8df;
  --gold: #bc8b3c;
  --shadow: 0 18px 50px rgba(49, 43, 34, 0.11);
  --shadow-small: 0 8px 24px rgba(49, 43, 34, 0.09);
  --serif: "Noto Serif SC", "Source Han Serif SC", "STZhongsong",
    "Songti SC", "SimSun", serif;
  --sans: "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei",
    "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(185, 139, 60, 0.13), transparent 27rem),
    radial-gradient(circle at 96% 26%, rgba(169, 54, 44, 0.09), transparent 25rem),
    var(--paper);
  font-family: var(--sans);
  line-height: 1.6;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.paper-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.32;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 3px,
      rgba(57, 63, 58, 0.025) 3px,
      rgba(57, 63, 58, 0.025) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 4px,
      rgba(57, 63, 58, 0.018) 4px,
      rgba(57, 63, 58, 0.018) 5px
    );
}

.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 14px;
  border-bottom: 1px solid var(--line);
}

.brand,
.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-seal {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #fff8e9;
  background: var(--red);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 0 0 3px var(--red), inset 0 0 0 4px rgba(255, 248, 233, 0.42);
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  transform: rotate(-2deg);
}

.brand-copy,
.admin-brand > span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-copy strong,
.admin-brand strong {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.06em;
}

.brand-copy small,
.admin-brand small {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 14px;
}

.site-nav a {
  position: relative;
  color: var(--ink-soft);
  text-decoration: none;
}

.site-nav a:not(.nav-admin)::after {
  position: absolute;
  right: 0;
  bottom: -6px;
  left: 0;
  height: 1px;
  content: "";
  background: var(--red);
  transform: scaleX(0);
  transition: transform 180ms ease;
}

.site-nav a:hover::after {
  transform: scaleX(1);
}

.nav-admin {
  padding: 8px 14px;
  color: var(--red-deep);
  border: 1px solid rgba(169, 54, 44, 0.35);
  border-radius: 999px;
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: clamp(44px, 7vw, 100px);
  align-items: center;
  min-height: 530px;
  padding: 76px 2% 82px;
}

.eyebrow,
.section-index {
  margin: 0 0 16px;
  color: var(--red);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
}

.eyebrow-line {
  width: 42px;
  height: 1px;
  background: var(--red);
}

.hero h1 {
  max-width: 750px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(48px, 7.4vw, 92px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.hero h1::after {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 12px;
  content: "";
  background: var(--red);
  border-radius: 50%;
  vertical-align: 0.16em;
}

.hero-intro {
  max-width: 660px;
  margin: 30px 0 36px;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.9;
}

.hero-stats {
  display: flex;
  gap: clamp(28px, 5vw, 66px);
}

.hero-stats > div {
  display: flex;
  flex-direction: column;
}

.hero-stats strong {
  color: var(--green);
  font-family: Georgia, var(--serif);
  font-size: 27px;
  line-height: 1.1;
}

.hero-stats span {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.issue-ticket {
  position: relative;
  min-height: 350px;
  padding: 58px 34px 42px;
  overflow: hidden;
  text-align: center;
  background:
    linear-gradient(rgba(255, 250, 240, 0.93), rgba(255, 250, 240, 0.93)),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 25px,
      rgba(41, 71, 60, 0.11) 25px,
      rgba(41, 71, 60, 0.11) 26px
    );
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  transform: rotate(1.6deg);
}

.issue-ticket::before,
.issue-ticket::after {
  position: absolute;
  left: 0;
  width: 100%;
  height: 16px;
  content: "";
  background: radial-gradient(circle at 8px 0, transparent 7px, var(--paper) 7.5px)
    0 0 / 16px 16px repeat-x;
}

.issue-ticket::before {
  top: -1px;
}

.issue-ticket::after {
  bottom: -1px;
  transform: rotate(180deg);
}

.issue-ticket > p {
  margin: 0 0 28px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.28em;
}

.issue-ticket strong {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 7px;
  color: var(--red);
  font-family: var(--serif);
  font-size: 22px;
}

.issue-ticket strong b {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 92px;
  font-weight: 400;
  line-height: 0.95;
}

.ticket-date {
  margin-top: 28px;
  padding-top: 20px;
  color: var(--green);
  border-top: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 16px;
}

.ticket-status {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 10px;
  color: var(--ink-soft);
  background: rgba(41, 71, 60, 0.08);
  border-radius: 999px;
  font-size: 11px;
}

.ticket-hole {
  position: absolute;
  left: 20px;
  width: 7px;
  height: 7px;
  background: var(--paper-deep);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.ticket-hole-top {
  top: 22px;
}

.ticket-hole-bottom {
  bottom: 22px;
}

.content-section {
  padding: 76px 0 88px;
  border-top: 1px solid var(--line-strong);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 38px;
}

.section-heading .section-index {
  margin-bottom: 7px;
}

.section-heading h2,
.card-heading h2,
.help-card h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(29px, 4vw, 42px);
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.quiet-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  padding: 10px 19px;
  text-decoration: none;
  border-radius: 3px;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.quiet-button {
  color: var(--green);
  background: transparent;
  border: 1px solid var(--line-strong);
}

.quiet-button:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.primary-button {
  color: #fffaf0;
  background: var(--red);
  border: 1px solid var(--red);
  box-shadow: 0 6px 16px rgba(127, 33, 28, 0.18);
}

.primary-button:hover {
  background: var(--red-deep);
  box-shadow: 0 9px 22px rgba(127, 33, 28, 0.24);
  transform: translateY(-1px);
}

.secondary-button {
  color: #fff;
  background: var(--green);
  border: 1px solid var(--green);
}

.secondary-button:hover {
  background: #1c332a;
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none !important;
}

.text-button,
.text-link {
  padding: 0;
  color: var(--red-deep);
  background: none;
  border: 0;
  border-bottom: 1px solid rgba(127, 33, 28, 0.35);
  text-decoration: none;
}

.loading-panel,
.error-panel {
  display: grid;
  min-height: 280px;
  place-items: center;
  align-content: center;
  padding: 40px;
  text-align: center;
  background: rgba(255, 250, 240, 0.54);
  border: 1px dashed var(--line-strong);
}

.loading-mark {
  width: 37px;
  height: 37px;
  border: 2px solid rgba(169, 54, 44, 0.19);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 760ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-panel p,
.error-panel p {
  margin: 15px 0 0;
  color: var(--ink-soft);
}

.error-panel strong {
  font-family: var(--serif);
  font-size: 22px;
}

.error-panel .primary-button {
  margin-top: 20px;
}

.period-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  padding: 18px 21px;
  color: var(--green);
  background: var(--green-light);
  border-left: 4px solid var(--green);
}

.period-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
}

.date-chip {
  padding: 3px 9px;
  color: #fff;
  background: var(--green);
  border-radius: 2px;
  font-size: 12px;
}

.today-badge {
  padding: 3px 8px;
  color: var(--red-deep);
  background: rgba(255, 250, 240, 0.8);
  border: 1px solid rgba(169, 54, 44, 0.25);
  border-radius: 999px;
  font-size: 11px;
}

.period-counts {
  display: flex;
  gap: 24px;
  color: var(--ink-soft);
  font-size: 13px;
}

.period-counts b {
  color: var(--green);
  font-family: Georgia, serif;
  font-size: 17px;
}

.daily-note {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin: 20px 0 0;
  padding: 21px 24px;
  background: #fff8e7;
  border: 1px solid rgba(188, 139, 60, 0.38);
}

.note-mark {
  flex: 0 0 auto;
  padding: 3px 8px;
  color: #fff8e7;
  background: var(--gold);
  border-radius: 2px;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.daily-note p {
  margin: 0;
  white-space: pre-wrap;
}

.homework-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.homework-grid.single-card {
  grid-template-columns: minmax(0, 1fr);
}

.homework-card {
  position: relative;
  display: flex;
  min-height: 275px;
  flex-direction: column;
  padding: 27px 28px 25px;
  overflow: hidden;
  background: var(--card-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-small);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
  animation: rise-in 430ms both;
}

.homework-card::before {
  position: absolute;
  top: 0;
  right: 0;
  width: 74px;
  height: 5px;
  content: "";
  background: var(--subject-color, var(--red));
}

.homework-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 16px 35px rgba(49, 43, 34, 0.14);
  transform: translateY(-3px);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.homework-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 21px;
}

.subject-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
}

.subject-dot {
  width: 8px;
  height: 8px;
  background: var(--subject-color, var(--red));
  border-radius: 50%;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--subject-color, var(--red)) 12%, transparent);
}

.subject-name {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1.2;
}

.teacher-name {
  color: var(--ink-soft);
  font-size: 12px;
}

.homework-content {
  flex: 1;
  margin: 0 0 23px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
  line-height: 1.85;
}

.homework-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  color: var(--ink-soft);
  background: rgba(41, 71, 60, 0.07);
  border-radius: 2px;
  font-size: 11px;
}

.meta-tag.deadline {
  color: var(--red-deep);
  background: rgba(169, 54, 44, 0.08);
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 16px;
}

.attachment-link {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  overflow: hidden;
  color: var(--green);
  background: #edf2eb;
  border: 1px solid rgba(41, 71, 60, 0.13);
  text-decoration: none;
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.attachment-link:hover {
  border-color: rgba(41, 71, 60, 0.35);
}

.attachment-link svg {
  flex: 0 0 auto;
}

.daily-homework-card {
  min-height: 0;
  padding: 32px clamp(22px, 4vw, 48px) 38px;
}

.daily-homework-text {
  margin: 0 0 24px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--serif);
  font-size: clamp(17px, 2.2vw, 23px);
  line-height: 1.95;
}

.daily-image-link {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  background: #ece6da;
  border: 1px solid var(--line);
}

.daily-homework-image {
  display: block;
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
  transition: transform 220ms ease;
}

.daily-image-link:hover .daily-homework-image {
  transform: scale(1.012);
}

.history-image-link {
  display: block;
  width: min(520px, 100%);
  margin: 0 0 14px;
  overflow: hidden;
  background: #ece6da;
  border: 1px solid var(--line);
}

.history-image {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
}

.empty-state {
  padding: 68px 28px;
  text-align: center;
  background: rgba(255, 250, 240, 0.5);
  border: 1px dashed var(--line-strong);
}

.empty-number {
  display: block;
  color: rgba(169, 54, 44, 0.28);
  font-family: Georgia, serif;
  font-size: 78px;
  line-height: 1;
}

.empty-state h3 {
  margin: 8px 0 8px;
  font-family: var(--serif);
  font-size: 23px;
}

.empty-state p {
  margin: 0 0 16px;
  color: var(--ink-soft);
}

.history-section {
  padding-bottom: 102px;
}

.history-heading {
  align-items: center;
}

.search-form {
  display: flex;
  width: min(420px, 100%);
  background: var(--card-strong);
  border: 1px solid var(--line-strong);
}

.search-form input {
  min-width: 0;
  flex: 1;
  padding: 11px 14px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
}

.search-form input:focus {
  box-shadow: inset 0 -2px 0 var(--red);
}

.search-form button {
  padding: 0 18px;
  color: #fff;
  background: var(--green);
  border: 0;
}

.history-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 35px;
  margin-bottom: 16px;
  color: var(--ink-soft);
  font-size: 13px;
}

.history-summary p {
  margin: 0;
}

.history-list {
  border-top: 1px solid var(--line-strong);
}

.history-period {
  border-bottom: 1px solid var(--line);
}

.history-period summary {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto 20px;
  gap: 22px;
  align-items: center;
  padding: 25px 7px;
  list-style: none;
  cursor: pointer;
}

.history-period summary::-webkit-details-marker {
  display: none;
}

.history-period summary:hover {
  background: rgba(255, 255, 255, 0.28);
}

.history-date {
  display: flex;
  flex-direction: column;
}

.history-date strong {
  font-family: Georgia, var(--serif);
  font-size: 27px;
  line-height: 1;
}

.history-date span {
  margin-top: 7px;
  color: var(--ink-soft);
  font-size: 11px;
}

.history-subjects {
  min-width: 0;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 17px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.history-count {
  color: var(--ink-soft);
  font-size: 12px;
}

.history-chevron {
  width: 8px;
  height: 8px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 180ms ease;
}

.history-period[open] .history-chevron {
  transform: rotate(225deg) translate(-1px, -1px);
}

.history-detail {
  padding: 3px 7px 30px 134px;
}

.history-note {
  margin: 0 0 14px;
  padding: 12px 15px;
  color: var(--ink-soft);
  background: rgba(188, 139, 60, 0.08);
  border-left: 2px solid var(--gold);
  white-space: pre-wrap;
  font-size: 13px;
}

.history-entry {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 20px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.history-entry:first-of-type {
  border-top: 0;
}

.history-subject {
  color: var(--green);
  font-family: var(--serif);
  font-weight: 700;
}

.history-entry-content {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.75;
}

.history-entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 9px;
  color: var(--ink-soft);
  font-size: 12px;
}

.history-attachments {
  margin-top: 10px;
}

.history-empty {
  margin-top: 20px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 33px 0 40px;
  color: rgba(255, 250, 240, 0.82);
  border-top: 5px solid var(--red);
  background: var(--green);
  box-shadow: 0 0 0 100vmax var(--green);
  clip-path: inset(0 -100vmax);
  font-size: 12px;
}

.site-footer div {
  display: flex;
  flex-direction: column;
}

.site-footer strong {
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.08em;
}

.site-footer span,
.site-footer p {
  margin: 5px 0 0;
  color: rgba(255, 250, 240, 0.61);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: min(380px, calc(100% - 40px));
  padding: 12px 18px;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--red-deep);
}

/* Admin */
.admin-body {
  background:
    linear-gradient(120deg, rgba(41, 71, 60, 0.065), transparent 38%),
    radial-gradient(circle at 93% 8%, rgba(169, 54, 44, 0.085), transparent 24rem),
    var(--paper);
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px 20px;
}

.login-card {
  width: min(520px, 100%);
  padding: clamp(32px, 6vw, 56px);
  background: var(--card-strong);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.login-card .admin-brand {
  margin-bottom: 62px;
}

.login-card .section-index {
  margin-bottom: 8px;
}

.login-card h1 {
  margin: 0 0 13px;
  font-family: var(--serif);
  font-size: 38px;
}

.login-help {
  margin: 0 0 38px;
  color: var(--ink-soft);
  font-size: 14px;
}

.login-card label,
.entry-card label {
  display: block;
}

.login-card label > span,
.login-card form > label,
.entry-card label > span {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.password-row {
  display: flex;
}

.password-row input {
  min-width: 0;
  flex: 1;
  padding: 12px 14px;
  color: var(--ink);
  background: #fbf7ed;
  border: 1px solid var(--line-strong);
  border-right: 0;
  outline: none;
}

.password-row input:focus {
  border-color: var(--green);
  box-shadow: inset 0 -2px 0 var(--green);
}

.form-error {
  margin: 12px 0 0;
  color: var(--red-deep);
  font-size: 13px;
}

.back-link {
  display: inline-block;
  margin-top: 38px;
  color: var(--ink-soft);
  font-size: 13px;
  text-decoration: none;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.danger-text {
  color: var(--red-deep);
  border-color: rgba(127, 33, 28, 0.34);
}

.admin-shell {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: 52px 0 80px;
}

.admin-welcome {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 34px;
}

.admin-welcome .section-index {
  margin-bottom: 7px;
}

.admin-welcome h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(36px, 5vw, 55px);
  line-height: 1.15;
}

.admin-welcome p:last-child {
  margin: 13px 0 0;
  color: var(--ink-soft);
}

.date-control {
  display: flex;
  min-width: 235px;
  flex-direction: column;
  gap: 7px;
  padding: 14px 16px;
  background: var(--card-strong);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-small);
}

.date-control span {
  color: var(--red);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.date-control input {
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
  font-family: Georgia, var(--serif);
  font-size: 19px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.75fr);
  gap: 24px;
  align-items: start;
}

.admin-main-column,
.admin-side-column {
  display: grid;
  gap: 24px;
}

.admin-side-column {
  position: sticky;
  top: 24px;
}

.admin-card {
  padding: 28px;
  background: rgba(255, 253, 247, 0.88);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-small);
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 27px;
}

.card-heading .section-index {
  margin-bottom: 5px;
}

.card-heading h2,
.help-card h2 {
  font-size: 26px;
}

.compact-heading {
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 19px;
}

.form-span {
  grid-column: 1 / -1;
}

.entry-card input,
.entry-card textarea,
.note-card textarea {
  width: 100%;
  padding: 12px 13px;
  color: var(--ink);
  background: #fbf7ed;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.entry-card textarea,
.note-card textarea {
  resize: vertical;
}

.entry-card input:focus,
.entry-card textarea:focus,
.note-card textarea:focus {
  border-color: var(--green);
  box-shadow: inset 0 -2px 0 var(--green);
}

.entry-card label > span b {
  color: var(--red);
}

.file-field input[type="file"] {
  padding: 9px;
  font-size: 13px;
}

.file-field small,
.side-help {
  display: block;
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

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

.save-hint {
  color: var(--ink-soft);
  font-size: 12px;
}

.count-pill {
  padding: 4px 10px;
  color: var(--green);
  background: var(--green-light);
  border-radius: 999px;
  font-size: 12px;
}

.admin-entry-list {
  display: grid;
  gap: 12px;
}

.admin-entry-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 18px 19px;
  background: #fbf8ef;
  border: 1px solid var(--line);
  border-left: 4px solid var(--subject-color, var(--green));
}

.admin-entry-item h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 20px;
}

.admin-entry-item h3 small {
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
}

.admin-entry-item p {
  margin: 0;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.75;
}

.admin-entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 11px;
}

.entry-actions {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.entry-actions button {
  padding: 2px 0;
  color: var(--green);
  background: none;
  border: 0;
  border-bottom: 1px solid currentColor;
  font-size: 12px;
}

.entry-actions .delete-entry {
  color: var(--red-deep);
}

.admin-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
}

.admin-attachment {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 5px 8px;
  overflow: hidden;
  color: var(--green);
  background: #eaf0e8;
  font-size: 11px;
  text-decoration: none;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.admin-attachment button {
  padding: 0;
  color: var(--red-deep);
  background: none;
  border: 0;
  font-size: 14px;
}

.compact {
  padding: 27px 18px;
}

.compact p {
  margin: 0;
  font-size: 13px;
}

.note-card form,
.import-card form {
  display: grid;
  gap: 13px;
}

.note-card .secondary-button,
.import-card .secondary-button {
  width: 100%;
}

.help-card {
  color: #f8f3e8;
  background: var(--green);
  border-color: var(--green);
}

.help-card .section-index {
  color: #d9be85;
}

.help-card ul {
  margin: 19px 0 0;
  padding-left: 18px;
  color: rgba(255, 250, 240, 0.76);
  font-size: 13px;
  line-height: 1.9;
}

.simple-admin-shell {
  width: min(1180px, calc(100% - 48px));
}

.simple-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.65fr);
  gap: 24px;
  align-items: start;
}

.simple-admin-side {
  display: grid;
  gap: 24px;
}

.replace-notice {
  padding: 5px 10px;
  color: var(--red-deep);
  background: rgba(169, 54, 44, 0.08);
  border-radius: 999px;
  font-size: 11px;
}

.text-publish-field > span,
.image-publish-field > span {
  display: block;
  margin-bottom: 9px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.publish-card textarea {
  width: 100%;
  padding: 17px 18px;
  color: var(--ink);
  background: #fbf7ed;
  border: 1px solid var(--line-strong);
  outline: none;
  resize: vertical;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.85;
}

.publish-card textarea:focus {
  border-color: var(--green);
  box-shadow: inset 0 -2px 0 var(--green);
}

.publish-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 23px 0;
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.publish-divider::before,
.publish-divider::after {
  height: 1px;
  flex: 1;
  content: "";
  background: var(--line);
}

.image-preview {
  display: grid;
  min-height: 280px;
  place-items: center;
  overflow: hidden;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(41, 71, 60, 0.025) 0,
      rgba(41, 71, 60, 0.025) 12px,
      transparent 12px,
      transparent 24px
    ),
    #f8f3e8;
  border: 1px dashed var(--line-strong);
}

.image-placeholder {
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 40px 20px;
  color: var(--ink-soft);
  text-align: center;
}

.image-placeholder > span {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 15px;
  place-items: center;
  color: var(--red);
  border: 1px solid rgba(169, 54, 44, 0.35);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 28px;
  line-height: 1;
}

.image-placeholder strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
}

.image-placeholder small {
  margin-top: 7px;
  font-size: 11px;
}

#preview-image {
  display: block;
  width: 100%;
  max-height: 620px;
  object-fit: contain;
}

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

.file-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  color: #fff;
  background: var(--green);
  border: 1px solid var(--green);
  cursor: pointer;
  font-size: 13px;
}

.file-button:hover {
  background: #1c332a;
}

.publish-actions {
  justify-content: space-between;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.current-publish-preview {
  display: grid;
  gap: 15px;
}

.view-count-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  margin-bottom: 20px;
  padding: 17px 18px;
  background: var(--green-light);
  border-left: 4px solid var(--green);
}

.view-count-card span {
  color: var(--green);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
}

.view-count-card strong {
  grid-row: 1 / span 2;
  grid-column: 2;
  color: var(--red);
  font-family: Georgia, serif;
  font-size: 42px;
  line-height: 1;
}

.view-count-card small {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 10px;
}

.current-image {
  display: block;
  width: 100%;
  max-height: 410px;
  object-fit: contain;
  background: #ece6da;
  border: 1px solid var(--line);
}

.current-text {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.85;
}

.delete-current {
  margin-top: 19px;
}

.simple-help-card {
  position: sticky;
  top: 24px;
}

code {
  padding: 2px 5px;
  color: var(--red-deep);
  background: rgba(169, 54, 44, 0.08);
  font-family: Consolas, monospace;
}

@media (max-width: 940px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 45px;
    padding-top: 55px;
  }

  .issue-ticket {
    width: min(350px, 100%);
    min-height: 310px;
    justify-self: center;
  }

  .issue-ticket strong b {
    font-size: 78px;
  }

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

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

  .admin-side-column {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .simple-help-card {
    position: static;
  }

  .help-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .site-header,
  .page-shell,
  .site-footer,
  .admin-header,
  .admin-shell {
    width: min(100% - 28px, 1180px);
  }

  .site-header {
    align-items: flex-start;
    padding-top: 18px;
  }

  .site-nav {
    gap: 12px;
  }

  .site-nav a:not(.nav-admin) {
    display: none;
  }

  .nav-admin {
    padding: 6px 10px;
    font-size: 12px;
  }

  .brand-seal {
    width: 42px;
    height: 42px;
    font-size: 10px;
  }

  .brand-copy strong,
  .admin-brand strong {
    font-size: 15px;
  }

  .brand-copy small,
  .admin-brand small {
    font-size: 9px;
  }

  .hero {
    min-height: 0;
    padding: 54px 0 68px;
  }

  .hero h1 {
    font-size: clamp(44px, 15vw, 65px);
  }

  .hero-intro {
    margin: 24px 0 30px;
    font-size: 15px;
  }

  .hero-stats {
    justify-content: space-between;
    gap: 15px;
  }

  .hero-stats strong {
    font-size: 22px;
  }

  .issue-ticket {
    transform: rotate(0.8deg);
  }

  .content-section {
    padding: 58px 0 68px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .history-heading {
    align-items: stretch;
  }

  .search-form {
    width: 100%;
  }

  .period-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .period-counts {
    width: 100%;
    justify-content: space-between;
  }

  .homework-grid {
    grid-template-columns: 1fr;
  }

  .homework-grid.single-card {
    grid-template-columns: 1fr;
  }

  .homework-card {
    min-height: 0;
  }

  .daily-note {
    flex-direction: column;
    gap: 10px;
  }

  .history-period summary {
    grid-template-columns: 82px minmax(0, 1fr) 18px;
    gap: 13px;
  }

  .history-count {
    display: none;
  }

  .history-detail {
    padding: 2px 4px 25px 0;
  }

  .history-entry {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 13px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .admin-header {
    align-items: flex-start;
  }

  .admin-header-actions {
    align-items: flex-end;
    flex-direction: column;
    gap: 8px;
  }

  .admin-welcome {
    align-items: stretch;
    flex-direction: column;
  }

  .date-control {
    min-width: 0;
    width: 100%;
  }

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

  .simple-admin-shell {
    width: min(100% - 28px, 1180px);
  }

  .image-preview {
    min-height: 220px;
  }

  .publish-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .publish-actions .primary-button {
    width: 100%;
  }

  .help-card {
    grid-column: auto;
  }

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

  .form-span {
    grid-column: auto;
  }

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

  .entry-actions {
    justify-content: flex-end;
  }

  .login-card .admin-brand {
    margin-bottom: 44px;
  }

  .password-row {
    display: grid;
    gap: 10px;
  }

  .password-row input {
    border-right: 1px solid var(--line-strong);
  }

  .password-row .primary-button {
    width: 100%;
  }
}

@media print {
  .site-header,
  .site-nav,
  .hero,
  .history-section,
  .site-footer,
  .quiet-button,
  .toast {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .page-shell {
    width: 100%;
  }

  .content-section {
    padding: 0;
    border: 0;
  }

  .homework-grid {
    grid-template-columns: 1fr 1fr;
  }

  .homework-card {
    break-inside: avoid;
    box-shadow: none;
  }
}

body.modal-open {
  overflow: hidden;
}

.calendar-open-button {
  min-width: 150px;
}

.calendar-invite {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  padding: 28px 30px;
  background: rgba(255, 253, 247, 0.72);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-small);
}

.calendar-invite h3 {
  margin: 0 0 5px;
  font-family: var(--serif);
  font-size: 22px;
}

.calendar-invite p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.calendar-invite-icon {
  display: grid;
  width: 54px;
  height: 54px;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 13px;
  background: var(--green-light);
  border: 1px solid rgba(41, 71, 60, 0.16);
}

.calendar-invite-icon i {
  display: block;
  background: var(--green);
}

.calendar-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
}

.calendar-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  background: rgba(22, 30, 27, 0.68);
  border: 0;
  backdrop-filter: blur(5px);
}

.calendar-dialog {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(90vh, 900px);
  padding: 30px;
  overflow: auto;
  background: var(--card-strong);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
}

.calendar-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 27px;
}

.calendar-dialog-head .section-index {
  margin-bottom: 5px;
}

.calendar-dialog-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 32px;
}

.modal-close {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  font-family: Georgia, serif;
  font-size: 24px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--red);
  border-color: rgba(169, 54, 44, 0.38);
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 110px;
  gap: 14px;
  align-items: center;
  margin-bottom: 11px;
}

.calendar-toolbar strong {
  text-align: center;
  font-family: var(--serif);
  font-size: 23px;
}

.calendar-nav,
.calendar-today-button {
  padding: 8px 10px;
  color: var(--green);
  background: transparent;
  border: 1px solid var(--line);
  font-size: 12px;
}

.calendar-nav:hover,
.calendar-today-button:hover {
  background: var(--green-light);
  border-color: rgba(41, 71, 60, 0.2);
}

.calendar-today-button {
  display: block;
  margin: 0 auto 24px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  margin-bottom: 8px;
  color: var(--ink-soft);
  text-align: center;
  font-size: 11px;
}

.calendar-grid {
  gap: 7px;
}

.calendar-cell {
  position: relative;
  display: grid;
  min-height: 68px;
  place-items: center;
  color: var(--ink);
  background: #f8f4ea;
  border: 1px solid transparent;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.calendar-cell:not(.calendar-cell-empty):hover {
  background: #eef2eb;
  border-color: rgba(41, 71, 60, 0.22);
  transform: translateY(-1px);
}

.calendar-cell-empty {
  background: transparent;
}

.calendar-cell.has-homework {
  color: var(--green);
  background: var(--green-light);
  border-color: rgba(41, 71, 60, 0.15);
  font-weight: 700;
}

.calendar-cell.is-today {
  box-shadow: inset 0 0 0 2px var(--red);
}

.calendar-cell.is-active {
  background: #fff3e2;
  border-color: var(--gold);
}

.calendar-day-number {
  font-family: Georgia, var(--serif);
  font-size: 17px;
}

.calendar-day-marker {
  position: absolute;
  right: 6px;
  bottom: 5px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: #fff;
  background: var(--red);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
}

.calendar-legend {
  display: flex;
  gap: 22px;
  justify-content: center;
  margin-top: 21px;
  color: var(--ink-soft);
  font-size: 11px;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  background: var(--green);
  border-radius: 50%;
}

.legend-ring {
  width: 10px;
  height: 10px;
  border: 2px solid var(--red);
  border-radius: 50%;
}

.day-back {
  padding: 0;
  color: var(--green);
  background: none;
  border: 0;
  border-bottom: 1px solid currentColor;
  font-size: 12px;
}

.day-view-heading {
  margin: 24px 0 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.day-view-heading .section-index {
  margin-bottom: 5px;
}

.day-view-heading h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 28px;
}

.day-content {
  display: grid;
  gap: 18px;
}

.calendar-day-text,
.calendar-day-note {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.9;
}

.calendar-day-note {
  padding: 14px 16px;
  color: #654d24;
  background: #fff5de;
  border-left: 3px solid var(--gold);
  font-size: 14px;
}

.calendar-day-image-link {
  display: block;
  overflow: hidden;
  background: #ece6da;
  border: 1px solid var(--line);
}

.calendar-day-image-link img {
  display: block;
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
}

.calendar-empty-day {
  padding: 50px 20px;
  text-align: center;
  background: #f8f4ea;
  border: 1px dashed var(--line-strong);
}

.calendar-empty-day > span {
  color: rgba(169, 54, 44, 0.34);
  font-family: Georgia, serif;
  font-size: 52px;
  line-height: 1;
}

.calendar-empty-day h4 {
  margin: 9px 0 5px;
  font-family: var(--serif);
  font-size: 20px;
}

.calendar-empty-day p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
}

@media (max-width: 720px) {
  .calendar-invite {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    padding: 22px 19px;
  }

  .calendar-invite > .text-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .calendar-modal {
    align-items: end;
    padding: 0;
  }

  .calendar-dialog {
    width: 100%;
    max-height: 94vh;
    padding: 24px 16px 30px;
    border-bottom: 0;
  }

  .calendar-dialog-head h2 {
    font-size: 27px;
  }

  .calendar-toolbar {
    grid-template-columns: 76px minmax(0, 1fr) 76px;
  }

  .calendar-toolbar strong {
    font-size: 19px;
  }

  .calendar-nav {
    padding: 7px 5px;
    font-size: 10px;
  }

  .calendar-grid {
    gap: 4px;
  }

  .calendar-cell {
    min-height: 52px;
  }

  .calendar-day-number {
    font-size: 14px;
  }

  .calendar-day-marker {
    right: 3px;
    bottom: 3px;
    width: 15px;
    height: 15px;
    font-size: 8px;
  }
}
