:root {
  --bg: #0a1020;
  --bg-2: #121b2d;
  --panel: rgba(17, 24, 39, 0.84);
  --panel-strong: #162338;
  --panel-soft: rgba(255, 255, 255, 0.04);
  --text: #edf4ff;
  --text-soft: #aab9d6;
  --primary: #7c6cff;
  --primary-2: #5ee7d8;
  --primary-3: #8ec5ff;
  --success: #4fd3a8;
  --warning: #ffbf69;
  --danger: #ff7a7a;
  --line: rgba(255, 255, 255, 0.08);
  --shadow: 0 24px 52px rgba(5, 8, 17, 0.42);
  --soft-glow: 0 20px 40px rgba(124, 108, 255, 0.18);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(124, 108, 255, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(94, 231, 216, 0.12), transparent 25%),
    linear-gradient(180deg, #0a1020 0%, #0f1729 100%);
  color: var(--text);
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 26px auto 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: linear-gradient(180deg, rgba(18, 27, 45, 0.96), rgba(13, 20, 33, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow: var(--soft-glow);
  position: sticky;
  top: 12px;
  z-index: 10;
  backdrop-filter: blur(14px);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  font-weight: 800;
  letter-spacing: -0.04em;
  box-shadow: 0 12px 24px rgba(124, 108, 255, 0.38);
}

.brand-name {
  font-weight: 700;
  letter-spacing: -0.04em;
}

.brand-wrap small {
  color: var(--text-soft);
}

.tab-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.025);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tab-btn,
.primary-btn,
.ghost-btn,
.subject-btn,
.close-modal {
  border: 0;
  border-radius: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.tab-btn {
  background: transparent;
  color: var(--text-soft);
  padding: 10px 14px;
  font-weight: 600;
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.24), rgba(94, 231, 216, 0.14));
  color: var(--text);
  border: 1px solid rgba(124, 108, 255, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.primary-btn,
.ghost-btn {
  padding: 11px 16px;
  font-weight: 700;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  box-shadow: 0 10px 24px rgba(124, 108, 255, 0.34);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border: 1px solid var(--line);
}

.main-area {
  margin-top: 24px;
  display: grid;
}

.panel {
  background: linear-gradient(180deg, rgba(19, 28, 44, 0.92), rgba(12, 18, 29, 0.88));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 26px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b7c8f6;
  margin-bottom: 6px;
}

.panel-head h2,
.section-title {
  font-size: clamp(1.4rem, 2vw, 2.2rem);
  letter-spacing: -0.05em;
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.summary-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
  padding: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.summary-card .label {
  display: block;
  color: var(--text-soft);
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.summary-card strong {
  font-size: clamp(1.5rem, 2vw, 2rem);
  letter-spacing: -0.04em;
}

.schedule-grid {
  display: grid;
  gap: 14px;
}

.lesson-list {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.lesson-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.015));
  border-radius: 18px;
  padding: 15px 16px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.lesson-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lesson-time {
  display: inline-flex;
  min-width: 78px;
  justify-content: center;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.18), rgba(94, 231, 216, 0.12));
  color: #e3defd;
  font-weight: 700;
  border: 1px solid rgba(124, 108, 255, 0.2);
}

.subject-btn {
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(92, 225, 230, 0.12), rgba(124, 108, 255, 0.12));
  border: 1px solid rgba(92, 225, 230, 0.28);
  color: var(--text);
  font-weight: 700;
  border-radius: 10px;
}

.subject-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(92, 225, 230, 0.12);
}

.lesson-item:hover {
  border-color: rgba(124, 108, 255, 0.25);
  transform: translateY(-1px);
}

.week-table-wrap {
  overflow-x: auto;
}

.week-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  border-radius: 18px;
  overflow: hidden;
}

.week-table th,
.week-table td {
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

.week-table td {
  background: rgba(255, 255, 255, 0.012);
}

.week-table th {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.day-header {
  color: var(--text);
}

.period-cell {
  min-height: 98px;
}

.small-tag {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.16), rgba(94, 231, 216, 0.08));
  color: #f0ecff;
  border: 1px solid rgba(124, 108, 255, 0.18);
  font-weight: 600;
  margin-bottom: 6px;
  width: 100%;
  justify-content: center;
  letter-spacing: 0.02em;
}

.empty-cell {
  color: var(--text-soft);
  font-size: 0.86rem;
}

.subject-page-head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.subject-summary {
  color: var(--text-soft);
  margin: 4px 0 18px;
}

.subject-table {
  min-width: 560px;
}

.subject-table td:nth-child(3) {
  color: var(--text);
}

.editor-panel {
  margin-top: 22px;
}

.admin-auth-box {
  margin-bottom: 14px;
}

.admin-login-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.admin-auth-field {
  display: grid;
  gap: 6px;
}

.admin-auth-field label {
  color: var(--text-soft);
  font-size: 0.88rem;
}

.admin-auth-field input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
}

textarea {
  min-height: 280px;
  resize: vertical;
  line-height: 1.6;
}

.admin-auth-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.auth-message {
  color: var(--warning);
  margin-top: 10px;
}

.helper-text {
  color: var(--text-soft);
  margin-bottom: 12px;
  line-height: 1.7;
}

.helper-text span {
  color: var(--primary-2);
}

.editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 12, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-card {
  position: relative;
  width: min(560px, 100%);
  background: linear-gradient(180deg, rgba(17, 26, 40, 0.97), rgba(11, 16, 27, 0.97));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px 22px 20px;
  box-shadow: var(--shadow);
}

.close-modal {
  position: absolute;
  right: 14px;
  top: 12px;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 1.5rem;
}

.modal-content h3 {
  margin-bottom: 16px;
  font-size: clamp(1.5rem, 2vw, 2rem);
}

.modal-content .meta-list,
.modal-content .assign-list {
  list-style: none;
  display: grid;
  gap: 10px;
}

.meta-list li,
.assign-list li {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text-soft);
}

.assign-list strong {
  color: var(--text);
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.01);
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 16px, 1200px);
    margin: 12px auto 28px;
  }

  .topbar {
    flex-wrap: wrap;
    justify-content: center;
    padding: 14px 14px 12px;
    gap: 12px;
    border-radius: 18px;
  }

  .brand-wrap {
    width: 100%;
    justify-content: center;
  }

  .tab-nav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    padding: 6px;
  }

  .tab-btn {
    flex: 1 1 32%;
    min-width: 86px;
    padding: 10px 8px;
    font-size: 0.92rem;
  }

  .primary-btn,
  .ghost-btn {
    padding: 11px 14px;
    font-size: 0.95rem;
  }

  .panel {
    padding: 16px 14px;
    border-radius: 18px;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 14px;
  }

  .summary-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .summary-card {
    padding: 14px 16px;
  }

  .lesson-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
  }

  .lesson-meta {
    width: 100%;
  }

  .lesson-time {
    min-width: 66px;
    padding: 7px 9px;
    font-size: 0.8rem;
  }

  .subject-btn {
    font-size: 0.92rem;
    padding: 8px 10px;
  }

  .week-table {
    min-width: 640px;
  }

  .admin-login-form {
    grid-template-columns: 1fr;
  }

  .admin-auth-actions {
    grid-column: auto;
    justify-content: stretch;
  }

  .admin-auth-actions .primary-btn,
  .editor-actions .primary-btn,
  .editor-actions .ghost-btn {
    width: 100%;
  }

  .editor-actions {
    flex-direction: column;
  }

  textarea {
    min-height: 220px;
  }

  .modal-card {
    padding: 18px 14px 16px;
    border-radius: 18px;
  }
}

@media (max-width: 480px) {
  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 0.82rem;
  }

  .brand-name {
    font-size: 0.96rem;
  }

  .tab-btn {
    flex-basis: calc(33.333% - 4px);
    font-size: 0.82rem;
  }

  .panel-head h2,
  .section-title {
    font-size: 1.3rem;
  }

  .summary-card strong {
    font-size: 1.5rem;
  }

  .lesson-item {
    padding: 10px 12px;
  }

  .modal-content h3 {
    font-size: 1.4rem;
  }
}

:root {
  --bg: #f3f7f4;
  --bg-2: #e7f0ea;
  --panel: #ffffff;
  --panel-strong: #f8fbf8;
  --panel-soft: #f2f7f3;
  --text: #20332c;
  --text-soft: #62746b;
  --primary: #167a58;
  --primary-2: #e6b93d;
  --primary-3: #3479c8;
  --success: #238564;
  --warning: #b66d16;
  --danger: #c64d48;
  --line: #dce7df;
  --shadow: 0 16px 42px rgba(37, 72, 52, 0.09);
  --soft-glow: 0 10px 28px rgba(37, 72, 52, 0.08);
}

body {
  font-family: 'Nunito Sans', sans-serif;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(52, 121, 200, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52, 121, 200, 0.035) 1px, transparent 1px),
    linear-gradient(145deg, #f7faf5 0%, #edf5ef 58%, #f5f7ed 100%);
  background-size: 28px 28px, 28px 28px, auto;
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(52, 121, 200, 0.35);
  outline-offset: 2px;
}

.app-shell {
  width: min(1180px, calc(100% - 36px));
  margin-top: 20px;
}

.topbar {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #dfe9e1;
  border-radius: 18px;
  box-shadow: var(--soft-glow);
  backdrop-filter: blur(12px);
}

.brand-mark {
  border-radius: 12px;
  background: #167a58;
  color: #fffdf4;
  box-shadow: 0 8px 16px rgba(22, 122, 88, 0.2);
  letter-spacing: 0;
}

.brand-name,
.panel-head h2,
.section-title,
.assignment-card h3,
.admin-box h3,
.modal-content h3 {
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0;
}

.brand-name {
  font-size: 1.1rem;
}

.tab-nav {
  gap: 4px;
  padding: 5px;
  background: #f2f6f2;
  border: 1px solid #e4ece5;
  border-radius: 12px;
}

.tab-btn {
  border-radius: 9px;
  color: #62746b;
  white-space: nowrap;
}

.tab-btn.active {
  color: #125b43;
  background: #dff0e5;
  border: 1px solid #c7e2d0;
  box-shadow: none;
}

.primary-btn {
  color: #fff;
  background: #167a58;
  border-radius: 10px;
  box-shadow: 0 7px 14px rgba(22, 122, 88, 0.17);
}

.primary-btn:hover {
  background: #126849;
  transform: translateY(-1px);
}

.ghost-btn {
  color: #315344;
  background: #fff;
  border: 1px solid #d7e4da;
  border-radius: 10px;
}

.ghost-btn:hover {
  background: #f2f7f3;
  border-color: #a8cbb4;
}

.main-area {
  margin-top: 18px;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
}

.panel {
  min-width: 0;
  max-width: 100%;
  padding: 28px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e0e9e1;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.tab-panel.active {
  animation: panel-arrive 220ms ease-out both;
}

@keyframes panel-arrive {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-head h2 {
  color: #203c30;
  font-size: 1.8rem;
}

.eyebrow {
  color: #167a58;
  font-weight: 800;
  letter-spacing: 0;
}

.summary-card strong {
  letter-spacing: 0;
}

.lesson-item,
.assignment-card,
.summary-card,
.admin-box,
.editor {
  background: #fff;
  border: 1px solid #e0e9e1;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(37, 72, 52, 0.035);
}

.lesson-item {
  padding: 16px 18px;
}

.lesson-item:hover {
  border-color: #9bcab0;
  background: #fbfefb;
  transform: translateY(-1px);
}

.lesson-time {
  color: #185d47;
  background: #e3f2e8;
  border: 1px solid #cce5d3;
  border-radius: 9px;
}

.subject-btn {
  color: #245a86;
  background: #eaf3fc;
  border: 1px solid #d4e5f5;
  border-radius: 9px;
}

.subject-btn:hover {
  background: #dfedfa;
  box-shadow: none;
}

.week-table-wrap {
  min-width: 0;
  max-width: 100%;
  border: 1px solid #dfe8e0;
  border-radius: 12px;
  scrollbar-color: #9bbda5 #edf3ee;
}

.week-table {
  border-radius: 12px;
}

.week-table th,
.week-table td {
  border-color: #e3ebe4;
}

.week-table th {
  color: #52695c;
  background: #f0f6f0;
}

.week-table thead th {
  color: #fff;
  background: #287653;
}

.week-table tbody th {
  white-space: nowrap;
}

.week-table td {
  background: #fff;
}

.week-table tbody tr:nth-child(even) td {
  background: #fbfdfb;
}

.week-table .small-tag {
  color: #284b3c;
  background: #e7f3e9;
  border: 1px solid #d4e8d8;
  border-radius: 8px;
  letter-spacing: 0;
}

.week-table td:nth-child(3) .small-tag,
.week-table td:nth-child(6) .small-tag {
  color: #855e17;
  background: #fff4d8;
  border-color: #f2e2b6;
}

.week-table td:nth-child(4) .small-tag {
  color: #a44b43;
  background: #fff0ec;
  border-color: #f3d7d0;
}

.week-table td:nth-child(5) .small-tag {
  color: #315f98;
  background: #ebf3ff;
  border-color: #d8e5f6;
}

.assignment-card {
  padding: 18px;
  border-left: 4px solid #e6b93d;
}

.assignment-card h3 {
  color: #203c30;
  font-size: 1.2rem;
}

.assignment-date {
  color: #775913;
  background: #fff4d8;
  border: 1px solid #f2e2b6;
  border-radius: 8px;
  padding: 6px 9px;
}

.assignment-image {
  border-radius: 9px;
}

.editor-panel {
  border-top: 4px solid #e6b93d;
}

.admin-box,
.editor {
  padding: 18px;
  margin-top: 14px;
}

.admin-box h3 {
  color: #203c30;
  margin-bottom: 14px;
}

.auth-form,
.stack-form {
  display: grid;
  gap: 14px;
}

.field-row {
  display: grid;
  gap: 6px;
}

.field-row label {
  color: #52695c;
  font-size: 0.9rem;
  font-weight: 700;
}

.field-row input,
.field-row select,
.field-row textarea,
textarea {
  width: 100%;
  color: #20332c;
  background: #fbfdfb;
  border: 1px solid #d4e1d6;
  border-radius: 9px;
  padding: 11px 12px;
}

.field-row input::placeholder,
.field-row textarea::placeholder {
  color: #86978b;
}

.user-actions,
.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.user-badge {
  color: #165a43;
  background: #e2f1e6;
  border: 1px solid #c8e2d0;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.88rem;
  font-weight: 800;
}

.notification-inbox {
  margin-top: 24px;
  border-top: 1px solid #e1eae2;
  padding-top: 18px;
}

.notification-heading,
.notification-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.notification-heading h3,
.notification-item h4 {
  margin: 0;
  color: #203a30;
}

.notification-item {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #dce8de;
  border-left: 3px solid #16835d;
  border-radius: 6px;
  background: #fff;
}

.notification-item.is-read {
  border-left-color: #a8b8ac;
  background: #f7faf7;
}

.notification-item p {
  margin: 8px 0 0;
  color: #52695c;
  font-weight: 500;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.notification-item time,
.notification-read-label,
.notification-empty {
  color: #708077;
  font-size: 0.82rem;
}

.notification-empty {
  margin: 12px 0 0;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
}

.user-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.user-table th,
.user-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #e5ece5;
  text-align: left;
}

.user-table th {
  color: #52695c;
  background: #f3f7f3;
}

.user-table select {
  color: #20332c;
  background: #fff;
  border: 1px solid #d4e1d6;
  border-radius: 8px;
  padding: 7px 9px;
}

.moderation-controls {
  display: grid;
  min-width: 220px;
  gap: 7px;
}

.moderation-note {
  min-width: 210px;
  resize: vertical;
}

.moderation-controls .ghost-btn {
  justify-self: start;
}

#scheduleMessage {
  white-space: pre-line;
}

#accountAdminMessage {
  white-space: pre-line;
}

.error-text {
  color: #b42318;
}

.toast-region {
  position: fixed;
  z-index: 1000;
  top: 16px;
  right: 16px;
  display: grid;
  width: min(420px, calc(100vw - 32px));
  gap: 10px;
}

.toast {
  position: relative;
  padding: 15px 42px 14px 16px;
  border: 1px solid #d5e3d8;
  border-left: 4px solid #16835d;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 32px rgb(28 55 41 / 18%);
  animation: toast-enter 180ms ease-out;
}

.toast-error {
  border-left-color: #c0352b;
}

.toast-success {
  border-left-color: #16835d;
}

.toast-message {
  margin: 0;
  color: #263b31;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.toast-error .toast-message {
  color: #9f241c;
}

.toast-actions {
  margin-top: 7px;
}

.toast-action,
.toast-close {
  padding: 0;
  color: #176748;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.toast-close {
  position: absolute;
  top: 9px;
  right: 12px;
  color: #586a60;
  font-size: 1.25rem;
}

.toast-details {
  max-height: 220px;
  margin: 10px 0 0;
  padding: 10px;
  overflow: auto;
  color: #4e5a52;
  background: #f5f7f5;
  border-radius: 5px;
  font: 0.82rem/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@keyframes toast-enter {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.helper-text,
.subject-summary {
  color: var(--text-soft);
}

.helper-text span {
  color: #167a58;
}

.empty-state {
  color: #62746b;
  background: #f8fbf8;
  border-color: #bdcfc1;
  border-radius: 12px;
}

.hidden {
  display: none !important;
}

.account-content {
  width: min(100%, 480px);
  margin: 0 auto;
}

.account-content .panel-head {
  margin-bottom: 24px;
}

.account-content .auth-form .primary-btn {
  justify-self: start;
  min-width: 150px;
}

.auth-switch {
  display: inline-flex;
  margin-top: 16px;
  padding: 6px 0;
  color: #246c4f;
  background: transparent;
  border: 0;
  font-weight: 800;
  text-align: left;
}

.auth-switch:hover {
  color: #124f39;
  text-decoration: underline;
}

.account-session {
  display: block;
  padding: 16px 0;
}

.account-session-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.account-session p {
  color: #315344;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.admin-actions {
  margin-bottom: 16px;
}

.person-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: help;
}

.role-marker {
  display: inline-grid;
  width: 15px;
  height: 15px;
  place-items: center;
  font-size: 0.76rem;
  line-height: 1;
}

.role-marker-admin { color: #a56a13; }
.role-marker-moderator { color: #25765b; }
.role-marker-editor { color: #386c9a; }

.nickname-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px 12px;
  margin-top: 16px;
}

.nickname-form .helper-text {
  grid-column: 1 / -1;
  margin: 0;
}

.site-footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 24px;
  margin: 24px 0 0;
  padding: 12px 24px;
  border-top: 1px solid #d9e5db;
  color: #456052;
}

.footer-disclosure {
  min-width: 0;
  font-size: 0.88rem;
}

.footer-disclosure > summary {
  width: fit-content;
  color: #176748;
  font-weight: 800;
  cursor: pointer;
}

.site-credit-line {
  margin: 8px 0 0;
}

.supporter-area h2,
.report-submit-form h2 {
  margin: 0 0 8px;
  color: #264237;
  font-size: 1rem;
}

.supporter-list {
  display: flex;
  margin-top: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.supporter-item {
  min-width: min(100%, 220px);
  padding: 7px 10px;
  border: 1px solid #d8e4da;
  border-radius: 6px;
  background: #fff;
}

.supporter-item summary {
  color: #176748;
  font-weight: 800;
  cursor: pointer;
}

.supporter-item p {
  margin: 8px 0 2px;
  color: #596d61;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.supporter-empty {
  margin: 0;
  color: #708077;
  font-size: 0.9rem;
}

.site-info-admin {
  margin-top: 24px;
  padding: 12px 0;
  border-top: 1px solid #e1eae2;
}

.site-info-admin summary {
  color: #176748;
  font-weight: 800;
  cursor: pointer;
}

.site-info-admin .stack-form {
  max-width: 620px;
  margin-top: 14px;
}

.report-submit-form {
  display: grid;
  align-content: start;
  gap: 8px;
  width: min(100%, 420px);
  margin-top: 10px;
}

.report-login-hint {
  max-width: 420px;
  margin: 8px 0 0;
  color: #596d61;
}

.report-submit-form textarea,
.report-submit-form select {
  width: 100%;
  padding: 10px;
  color: #263b31;
  background: #fff;
  border: 1px solid #d4e1d6;
  border-radius: 6px;
}

.report-submit-form .ghost-btn {
  justify-self: start;
}

.admin-reports {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid #dfe9e1;
}

.admin-reports-list {
  display: grid;
  gap: 10px;
}

.admin-report {
  padding: 12px;
  border: 1px solid #dce8de;
  border-radius: 6px;
  background: #fff;
}

.admin-report.is-resolved {
  opacity: 0.72;
}

.admin-report-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.admin-report time {
  color: #708077;
  font-size: 0.82rem;
}

.admin-report p {
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  .app-shell {
    width: calc(100% - 20px);
    margin: 10px auto 24px;
  }

  .topbar {
    position: static;
    justify-content: space-between;
    padding: 12px;
    border-radius: 14px;
  }

  .brand-wrap {
    width: auto;
    justify-content: flex-start;
  }

  .tab-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tab-nav::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    flex: 0 0 auto;
    min-width: 76px;
    padding: 9px 12px;
  }

  .header-actions {
    justify-content: flex-end;
    gap: 6px;
  }

  .header-actions .ghost-btn,
  .header-actions .primary-btn {
    padding: 9px 10px;
    font-size: 0.86rem;
  }

  .panel {
    padding: 20px 16px;
    border-radius: 14px;
  }

  .panel-head h2 {
    font-size: 1.55rem;
  }

  .summary-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .summary-card {
    padding: 12px 10px;
  }

  .summary-card strong {
    font-size: 1.15rem;
    line-height: 1.25;
  }

  .summary-card .label {
    font-size: 0.75rem;
  }

  .lesson-item {
    align-items: flex-start;
  }

  .week-table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .editor-actions {
    flex-direction: row;
  }

  .site-footer {
    grid-template-columns: 1fr;
    padding: 18px 12px;
  }

  .nickname-form {
    grid-template-columns: 1fr;
  }

  .nickname-form .helper-text {
    grid-column: auto;
  }

  .admin-report-head {
    flex-direction: column;
    gap: 4px;
  }
}

@media (max-width: 480px) {
  .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 0.82rem;
  }

  .brand-name {
    font-size: 1rem;
  }

  .tab-btn {
    flex-basis: auto;
    font-size: 0.86rem;
  }

  .panel-head h2,
  .section-title {
    font-size: 1.4rem;
  }

  .summary-row {
    grid-template-columns: 1fr;
  }

  .summary-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .summary-card .label {
    margin: 0;
  }

  .summary-card strong {
    text-align: right;
  }

  .lesson-item {
    padding: 12px;
  }

  .lesson-meta {
    flex-wrap: nowrap;
  }

  .subject-btn {
    max-width: calc(100% - 78px);
    white-space: normal;
    text-align: left;
  }

  .editor-actions {
    flex-direction: column;
  }

  .editor-actions .primary-btn,
  .editor-actions .ghost-btn {
    width: 100%;
  }

  .admin-box,
  .editor {
    padding: 14px;
  }

  .account-session {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.assignment-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: -4px 0 18px;
  color: #52695c;
  font-weight: 700;
}

.assignment-toolbar select {
  min-height: 40px;
  padding: 8px 34px 8px 11px;
  color: #315344;
  background: #fff;
  border: 1px solid #d4e1d6;
  border-radius: 9px;
}

.assignment-list {
  display: grid;
  gap: 14px;
}

.assignment-card {
  overflow: hidden;
  padding: 0;
  border-left: 4px solid #e6b93d;
}

.assignment-open {
  display: block;
  width: 100%;
  padding: 19px 20px 15px;
  color: #20332c;
  background: #fff;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.assignment-open:hover {
  background: #fbfefb;
}

.assignment-card-meta,
.assignment-detail-meta,
.detail-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.assignment-subject {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  color: #245a86;
  background: #eaf3fc;
  border: 1px solid #d4e5f5;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 800;
}

.assignment-open h3 {
  margin: 13px 0 7px;
  color: #203c30;
  font-family: 'Outfit', sans-serif;
  font-size: 1.28rem;
}

.assignment-excerpt {
  display: -webkit-box;
  overflow: hidden;
  color: #52695c;
  line-height: 1.6;
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.assignment-social-preview {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 14px;
  color: #718178;
  font-size: 0.86rem;
}

.assignment-social-preview strong {
  color: #315344;
}

.assignment-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 18px;
  border-top: 1px solid #e6eee7;
}

.subject-page-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.assignment-detail-post {
  padding: 22px;
  background: #fff;
  border: 1px solid #e0e9e1;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(37, 72, 52, 0.06);
}

.detail-head {
  flex-direction: row;
  align-items: center;
}

.assignment-detail-meta {
  justify-content: flex-start;
  color: #718178;
  font-size: 0.9rem;
}

.post-author {
  color: #315344;
  font-weight: 800;
}

.assignment-detail-post h2 {
  margin: 16px 0 14px;
  color: #203c30;
  font-family: 'Outfit', sans-serif;
  font-size: 1.9rem;
}

.detail-due-date {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 12px 14px;
  color: #775913;
  background: #fff6df;
  border: 1px solid #f2e2b6;
  border-radius: 9px;
}

.assignment-full-content {
  margin: 20px 0;
  color: #344c3f;
  line-height: 1.75;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.detail-image {
  display: block;
  max-width: 100%;
  max-height: 480px;
  object-fit: contain;
  margin: 0 auto 20px;
}

.assignment-due-section {
  margin-top: 22px;
}

.detail-section-heading {
  margin-bottom: 10px;
}

.detail-section-heading h3 {
  color: #315344;
  font-family: 'Outfit', sans-serif;
  font-size: 1.08rem;
}

.detail-section-heading span {
  color: #718178;
  font-size: 0.88rem;
}

.due-week-table th.due-date-highlight,
.due-week-table td.due-date-highlight {
  background: #fff0be;
  border-color: #e6b93d;
}

.due-week-table thead th.due-date-highlight {
  color: #553d08;
}

.due-week-table thead th span {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
}

.due-week-subject {
  color: #315344;
  font-weight: 700;
}

.post-viewers {
  display: grid;
  gap: 5px;
  margin-top: 20px;
  padding: 14px 0;
  color: #718178;
  border-top: 1px solid #e6eee7;
  overflow-wrap: anywhere;
}

.post-viewers strong {
  color: #315344;
}

.post-helpful-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid #e6eee7;
  color: #52695c;
}

.helpful-button {
  min-height: 40px;
  padding: 8px 13px;
  color: #246c4f;
  background: #eef7ef;
  border: 1px solid #cfe4d3;
  border-radius: 9px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.helpful-button.is-helpful {
  color: #fff;
  background: #167a58;
  border-color: #167a58;
}

@media (max-width: 760px) {
  .assignment-detail-post {
    padding: 16px;
  }

  .assignment-detail-post h2 {
    font-size: 1.55rem;
  }

  .detail-head {
    flex-direction: row;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .assignment-toolbar {
    justify-content: space-between;
  }

  .assignment-open {
    padding: 15px 14px 12px;
  }

  .assignment-detail-post {
    padding: 13px;
  }

  .post-helpful-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101a15;
  --bg-2: #19271f;
  --panel: #1b2a22;
  --panel-strong: #26382d;
  --panel-soft: #223229;
  --text: #e7f0e9;
  --text-soft: #b2c2b6;
  --primary: #4eaa80;
  --primary-2: #e2b84c;
  --primary-3: #83b7e2;
  --success: #65c49b;
  --warning: #e3ae56;
  --danger: #ee8178;
  --line: #35483b;
  --shadow: 0 16px 42px rgba(0, 0, 0, 0.3);
  --soft-glow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

:root[data-theme="dark"] body {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(131, 183, 226, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(131, 183, 226, 0.035) 1px, transparent 1px),
    linear-gradient(145deg, #111b15 0%, #17251c 58%, #1d2519 100%);
  color: var(--text);
}

:root[data-theme="dark"] .topbar,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .lesson-item,
:root[data-theme="dark"] .assignment-card,
:root[data-theme="dark"] .summary-card,
:root[data-theme="dark"] .admin-box,
:root[data-theme="dark"] .editor,
:root[data-theme="dark"] .week-table-wrap,
:root[data-theme="dark"] .assignment-detail-post,
:root[data-theme="dark"] .notification-item,
:root[data-theme="dark"] .admin-report,
:root[data-theme="dark"] .supporter-item,
:root[data-theme="dark"] .toast {
  color: var(--text);
  background: #1b2a22;
  border-color: #35483b;
}

:root[data-theme="dark"] .tab-nav,
:root[data-theme="dark"] .week-table th,
:root[data-theme="dark"] .user-table th,
:root[data-theme="dark"] .notification-item.is-read,
:root[data-theme="dark"] .toast-details {
  color: var(--text-soft);
  background: #23342a;
  border-color: #35483b;
}

:root[data-theme="dark"] .panel-head h2,
:root[data-theme="dark"] .assignment-card h3,
:root[data-theme="dark"] .admin-box h3,
:root[data-theme="dark"] .notification-heading h3,
:root[data-theme="dark"] .notification-item h4,
:root[data-theme="dark"] .supporter-area h2,
:root[data-theme="dark"] .report-submit-form h2,
:root[data-theme="dark"] .site-credit-line,
:root[data-theme="dark"] .admin-report strong {
  color: var(--text);
}

:root[data-theme="dark"] .eyebrow,
:root[data-theme="dark"] .helper-text,
:root[data-theme="dark"] .subject-summary,
:root[data-theme="dark"] .assignment-excerpt,
:root[data-theme="dark"] .notification-item p,
:root[data-theme="dark"] .admin-report p,
:root[data-theme="dark"] .supporter-item p,
:root[data-theme="dark"] .report-login-hint,
:root[data-theme="dark"] .post-helpful-footer,
:root[data-theme="dark"] .account-session p {
  color: var(--text-soft);
}

:root[data-theme="dark"] .field-row input,
:root[data-theme="dark"] .field-row select,
:root[data-theme="dark"] .field-row textarea,
:root[data-theme="dark"] .user-table select,
:root[data-theme="dark"] .report-submit-form select,
:root[data-theme="dark"] .report-submit-form textarea,
:root[data-theme="dark"] textarea {
  color: var(--text);
  background: #142019;
  border-color: #455b4b;
}

:root[data-theme="dark"] .field-row label,
:root[data-theme="dark"] .user-table td,
:root[data-theme="dark"] .footer-disclosure,
:root[data-theme="dark"] .notification-item time,
:root[data-theme="dark"] .notification-read-label,
:root[data-theme="dark"] .notification-empty,
:root[data-theme="dark"] .admin-report time {
  color: var(--text-soft);
}

:root[data-theme="dark"] .ghost-btn {
  color: #d6e8db;
  background: #23352a;
  border-color: #405646;
}

:root[data-theme="dark"] .ghost-btn:hover {
  background: #2b4032;
  border-color: #60806a;
}

:root[data-theme="dark"] .tab-btn {
  color: var(--text-soft);
}

:root[data-theme="dark"] .tab-btn.active {
  color: #e7f5eb;
  background: #2d4d3a;
  border-color: #477456;
}

:root[data-theme="dark"] .week-table th,
:root[data-theme="dark"] .week-table td,
:root[data-theme="dark"] .week-table tbody tr:nth-child(even) td,
:root[data-theme="dark"] .user-table th,
:root[data-theme="dark"] .user-table td {
  color: var(--text-soft);
  background: #1b2a22;
  border-color: #35483b;
}

:root[data-theme="dark"] .week-table thead th {
  color: #f1f6f1;
  background: #315c43;
}

:root[data-theme="dark"] .week-table .small-tag {
  color: #e7f0e9;
  background: #2b4432;
  border-color: #435d49;
}

:root[data-theme="dark"] .user-badge {
  color: #d4efdf;
  background: #294334;
  border-color: #42674e;
}

:root[data-theme="dark"] .site-footer,
:root[data-theme="dark"] .notification-inbox,
:root[data-theme="dark"] .admin-reports,
:root[data-theme="dark"] .site-info-admin,
:root[data-theme="dark"] .account-session-head {
  border-color: #35483b;
}

:root[data-theme="dark"] .footer-disclosure > summary,
:root[data-theme="dark"] .site-info-admin summary,
:root[data-theme="dark"] .supporter-item summary,
:root[data-theme="dark"] .auth-switch,
:root[data-theme="dark"] .toast-action {
  color: #83c9a0;
}

:root[data-theme="dark"] .toast-error .toast-message {
  color: #ffaaa2;
}
