:root {
  --bg: #e8efe6;
  --bg-deep: #d5e2d3;
  --ink: #1c2a22;
  --muted: #5a6b60;
  --card: rgba(255, 252, 247, 0.92);
  --line: #b7c7b6;
  --accent: #1f6f54;
  --accent-deep: #14533e;
  --warn: #8a5a12;
  --danger: #8f2f2f;
  --shadow: 0 18px 40px rgba(28, 42, 34, 0.08);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 12% 10%, #f4f7e8 0%, transparent 42%),
    radial-gradient(circle at 88% 0%, #cfe3d7 0%, transparent 38%),
    linear-gradient(160deg, var(--bg), var(--bg-deep));
}

body {
  background-attachment: fixed;
}

.app-frame {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
  align-items: stretch;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: min(280px, 86vw);
  overflow: auto;
  padding: 16px 12px 24px;
  background:
    linear-gradient(180deg, #1d4f3d 0%, #163c2f 55%, #122f25 100%);
  color: #e8f3ec;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 40;
  transform: translateX(-105%);
  transition: transform 0.2s ease;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

body.sidebar-open .sidebar {
  transform: translateX(0);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(18, 30, 24, 0.45);
  z-index: 35;
}

body.sidebar-open .sidebar-backdrop {
  display: block;
}

.sidebar-toggle.icon-btn {
  display: inline-flex;
  width: auto;
  min-width: 34px;
  padding: 0 10px;
  gap: 6px;
}

.sidebar-toggle-label {
  font-size: 0.82rem;
  font-weight: 700;
}

.sidebar-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px 8px 16px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.sidebar-brand-text {
  min-width: 0;
}

.sidebar-brand .brand-kicker {
  color: rgba(232, 243, 236, 0.7);
  font-size: 0.58rem;
}

.sidebar-school {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  display: grid;
  gap: 4px;
  padding: 8px 0;
}

.nav-link,
.nav-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: rgba(232, 243, 236, 0.86);
  text-align: left;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.nav-link:hover,
.nav-group-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-link.active {
  background: rgba(255, 252, 247, 0.16);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.nav-link.nested {
  padding-left: 36px;
  font-size: 0.88rem;
  font-weight: 500;
}

.nav-ico {
  width: 1.1rem;
  text-align: center;
  opacity: 0.85;
  flex: 0 0 auto;
}

.nav-group-toggle {
  justify-content: flex-start;
}

.nav-caret {
  margin-left: auto;
  opacity: 0.7;
  transition: transform 0.15s ease;
}

.nav-group:not(.open) .nav-caret {
  transform: rotate(-90deg);
}

.nav-group:not(.open) .nav-group-items {
  display: none;
}

.nav-group-items {
  display: grid;
  gap: 2px;
  margin: 2px 0 8px;
}

.sidebar-backdrop {
  display: none;
}

.app-content {
  min-width: 0;
  padding: 14px 20px 56px;
  max-width: 1120px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.topbar-title-wrap {
  min-width: 0;
  flex: 1 1 auto;
}

.topbar-eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.2;
}

.topbar h1,
#page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.dash-card {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px 14px 12px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.dash-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.dash-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.dash-value {
  display: block;
  margin: 8px 0 4px;
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1;
  color: var(--accent-deep);
}

.dash-hint {
  font-size: 0.82rem;
  color: var(--muted);
}

.dash-actions {
  margin-top: 4px;
}

.dash-shortcut-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* Desktop / tablet: keep the sidebar permanently visible */
@media (min-width: 768px) {
  .app-frame {
    grid-template-columns: 248px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    width: auto;
    transform: none;
    box-shadow: none;
  }

  body.sidebar-open .sidebar {
    transform: none;
  }

  .sidebar-backdrop,
  body.sidebar-open .sidebar-backdrop {
    display: none !important;
  }

  .sidebar-toggle.icon-btn {
    display: none !important;
  }

  .app-content {
    padding: 14px 20px 56px;
  }
}

@media (max-width: 767px) {
  .app-content {
    padding: 12px 14px 48px;
  }
}

.app-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 20px 56px;
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background:
    linear-gradient(145deg, #2f8f6d, #184e3b),
    repeating-linear-gradient(
      -35deg,
      transparent,
      transparent 6px,
      rgba(255, 255, 255, 0.08) 6px,
      rgba(255, 255, 255, 0.08) 12px
    );
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-mark.has-logo {
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.logo-settings {
  margin: 14px 0 18px;
}

.logo-settings-label {
  margin: 0 0 8px;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.92rem;
}

.logo-settings-row {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.logo-preview-wrap {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-placeholder {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  padding: 6px;
}

.logo-settings-actions {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.brand-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.62rem;
  line-height: 1.2;
  color: var(--muted);
  font-weight: 600;
}

.topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.topbar-note {
  margin: 0;
  max-width: 240px;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: right;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--accent-deep);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover {
  background: color-mix(in srgb, var(--accent) 12%, var(--card));
  color: var(--ink);
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-gear,
.icon-bin {
  display: block;
}

.icon-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--card);
}

.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;
}

.modal-card-wide {
  width: min(720px, 100%);
}

#student-import-modal .modal-card-wide {
  width: min(860px, 100%);
}

.import-report-summary {
  margin: 0 0 14px;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink, #1a2e26);
}

.import-report-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 16px;
}

.import-stat {
  appearance: none;
  border: 1px solid #c9d8d0;
  background: #f4faf6;
  color: #184e3b;
  border-radius: 12px;
  min-width: 88px;
  padding: 10px 14px;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  cursor: pointer;
  font: inherit;
}

.import-stat-muted {
  cursor: default;
  background: #f7f5f0;
  border-color: #ddd4c4;
  color: #5c574e;
}

.import-stat-ok {
  background: #e7f5ee;
  border-color: #b7dfc8;
}

.import-stat-warn {
  background: #fff1e8;
  border-color: #f0c2a8;
  color: #8a3b2b;
}

.import-stat-count {
  font-size: 1.35rem;
  font-weight: 750;
  line-height: 1.1;
}

.import-stat-label {
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0.9;
}

.import-report-heading {
  margin: 8px 0 6px;
  font-size: 0.95rem;
  font-weight: 700;
}

.import-report-table-wrap {
  max-height: min(42vh, 360px);
  overflow: auto;
  margin: 8px 0 12px;
}

.import-report-table-wrap td.miss-reason {
  color: #8a3b2b;
  font-size: 0.92em;
}

.import-miss-row {
  cursor: pointer;
}

.import-miss-row:hover,
.import-miss-row.is-open {
  background: #fff7f1;
}

.import-why-box {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff1e8;
  color: #8a3b2b;
  font-size: 0.95rem;
}

.import-report-added {
  margin-top: 8px;
}

.import-report-added summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 8px;
}

.recycle-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  margin: 12px 0 14px;
}

.recycle-search {
  flex: 1 1 220px;
  margin: 0;
}

.recycle-search input {
  width: 100%;
}

.recycle-select-all {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
  cursor: pointer;
}

.recycle-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(52vh, 420px);
  overflow: auto;
  padding-right: 4px;
}

.recycle-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--card) 88%, #fff);
}

.recycle-item.is-selected {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--card));
}

.recycle-item-main {
  min-width: 0;
}

.recycle-item-title {
  margin: 0;
  font-weight: 600;
  line-height: 1.3;
}

.recycle-item-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.recycle-item-days {
  margin: 0;
  color: var(--warn);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.recycle-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.recycle-foot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn.danger:hover {
  filter: brightness(0.95);
}

.btn.danger:disabled,
.btn.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

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

.btn.danger-outline:hover {
  background: color-mix(in srgb, var(--danger) 8%, var(--card));
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.tab:hover {
  color: var(--ink);
  background: rgba(255, 252, 247, 0.45);
}

.tab.active {
  color: var(--accent-deep);
  background: var(--card);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 18px;
  padding: 6px;
  background: rgba(255, 252, 247, 0.55);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: fit-content;
  max-width: 100%;
}

.subtab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.subtab:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
}

.subtab.active {
  color: var(--accent-deep);
  background: var(--card);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.subpanel {
  display: none;
  animation: rise 0.28s ease;
}

.subpanel.active {
  display: block;
}

.panel {
  display: none;
  animation: rise 0.35s ease;
}

.panel.active {
  display: block;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.panel-head {
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.55rem;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  max-width: 60ch;
}

.form-card,
.table-wrap,
.status-box,
.timetable-view {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-card {
  padding: 18px;
  margin-bottom: 16px;
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 2px solid rgba(31, 111, 84, 0.35);
  border-color: var(--accent);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.check-row input {
  width: auto;
}

.day-fieldset {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 12px;
  margin: 0;
}

.break-fieldset {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin: 0;
  background: rgba(255, 255, 255, 0.45);
}

.break-fieldset legend {
  padding: 0 6px;
  font-weight: 700;
  font-size: 0.88rem;
}

.day-preview {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #f3f7f2;
}

.preview-title {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 0.9rem;
}

.preview-list {
  display: grid;
  gap: 6px;
}

.preview-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.9rem;
  background: #fff;
}

.preview-row.pv-period { border-left: 4px solid var(--accent); }
.preview-row.pv-assembly { border-left: 4px solid #3b6ea5; background: #eef4fb; }
.preview-row.pv-break { border-left: 4px solid #b8872d; background: #fbf6ea; }
.preview-row.pv-lunch { border-left: 4px solid #a65d3b; background: #f8eee8; }

.tt-time {
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.tt-break-row th,
.tt-break-cell {
  background: #f7f1e7 !important;
  color: #7a5a2b;
  font-weight: 600;
}

.day-fieldset.muted {
  opacity: 0.55;
}

.day-fieldset legend {
  padding: 0 6px;
  font-weight: 700;
  font-size: 0.88rem;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chip input {
  margin: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.chip.is-on {
  background: #e4f3ea;
  border-color: var(--accent);
  color: var(--accent-deep);
}

.chip:hover {
  border-color: var(--accent);
}

.multi-pick {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin: 0;
  background: rgba(255, 255, 255, 0.45);
}

.multi-pick legend {
  padding: 0 6px;
  font-weight: 700;
  font-size: 0.92rem;
}

.multi-pick-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.hint-inline {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.85rem;
}

.filter-bar {
  margin-bottom: 16px;
}

.filter-bar-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.filter-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.filter-total {
  margin: 0;
  font-weight: 700;
  color: var(--accent-deep);
  font-size: 1rem;
}

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}

.bulk-bar-left,
.bulk-bar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

#assignment-bulk-count,
#student-bulk-count {
  font-weight: 700;
  color: var(--accent-deep);
}

.col-check {
  width: 2.2rem;
  text-align: center;
}

.col-check input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

tr.is-selected td {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.proxy-load {
  margin: 12px 0 18px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.proxy-load-list {
  margin: 8px 0 0;
  padding-left: 1.2rem;
}

.proxy-uncovered {
  color: var(--danger);
  font-weight: 700;
}

.print-many-card {
  margin-bottom: 16px;
}

.print-batch {
  display: none;
}

.print-page {
  margin-bottom: 24px;
}

.screen-only {
  display: block;
}

.modal[hidden] {
  display: none !important;
}

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

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 30, 24, 0.45);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(28, 42, 34, 0.22);
  animation: rise 0.2s ease;
}

.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.modal-head {
  border-bottom: 1px solid var(--line);
}

.modal-foot {
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

.modal-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
}

.modal-body {
  padding: 16px;
  display: grid;
  gap: 14px;
}

#settings-modal .modal-card-wide {
  width: min(640px, 100%);
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#settings-modal .settings-modal-body {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.modal-body select[multiple] {
  min-height: 220px;
  padding: 8px;
}

.dropdown-check {
  display: grid;
  gap: 8px;
}

.dropdown-check-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  font-weight: 600;
  font-size: 0.92rem;
}

.dropdown-check-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.dropdown-check-toggle:hover {
  border-color: var(--accent);
}

.dropdown-check-menu {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  max-height: 280px;
  overflow: auto;
  box-shadow: 0 10px 24px rgba(28, 42, 34, 0.08);
}

.dropdown-check-list {
  display: grid;
  gap: 4px;
}

.dropdown-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.dropdown-check-item:hover {
  background: #f3f7f2;
}

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

.save-status {
  align-self: center;
  color: var(--accent-deep);
  font-size: 0.9rem;
  font-weight: 600;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

label.btn {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent-deep);
  color: #fff;
}

.btn.primary:hover {
  background: var(--accent-deep);
}

.btn.ghost {
  background: transparent;
}

.btn.danger-ghost {
  background: transparent;
  color: var(--danger);
  border-color: #e2b4b4;
}

.btn.small {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

td .row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.empty {
  color: var(--muted);
  padding: 18px 14px;
}

.att-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.att-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.att-chip strong {
  color: var(--accent-deep);
}

.att-absent-actions {
  margin: 8px 0 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

.att-notify-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #e0a090;
  background: #fff7f2;
  border-radius: 12px;
  font-size: 0.95rem;
}

.att-notify-banner[hidden] {
  display: none !important;
}

#att-absent-modal .modal-card {
  max-width: min(720px, 96vw);
}

#att-absent-modal .modal-body {
  max-height: min(70vh, 640px);
  overflow: auto;
}

.att-absent-list {
  display: grid;
  gap: 12px;
  margin: 0 0 8px;
}

.att-absent-card {
  background: #fff;
  border: 1px solid #edd2c6;
  border-radius: 12px;
  padding: 12px;
}

.att-absent-card-sent {
  border-color: #9bc4a8;
  background: #f4faf6;
}

.att-sms-sent-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #d8efe0;
  color: #1f5c38;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: middle;
}

.att-absent-card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.att-absent-actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.att-message-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #7a2e1f;
  margin: 0 0 4px;
}

.att-message-preview {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f7f5f0;
  border: 1px solid #e5dfd3;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #1a2e26;
}

.att-status-present { color: var(--accent-deep); }
.att-status-absent { color: var(--danger); }
.att-status-late { color: var(--warn); }
.att-status-excused { color: var(--muted); }

#att-table select {
  min-width: 120px;
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.2;
}

.account-chip .btn.small {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.account-role {
  font-weight: 700;
  color: var(--accent-deep);
}

.users-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 10px;
}

.users-table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.users-toolbar {
  margin: 0 0 14px;
  align-items: center;
}

.bulk-teacher-opts {
  margin-bottom: 12px;
}

.bulk-teacher-gen-wrap {
  align-self: end;
  margin-bottom: 4px;
}

.bulk-teacher-select-actions {
  margin-bottom: 8px;
}

.bulk-teacher-table .col-check {
  width: 2.5rem;
}

.bulk-teacher-username {
  width: 100%;
  min-width: 10rem;
}

.bulk-teacher-skipped {
  margin: 0;
  padding-left: 1.2rem;
}

#bulk-teacher-logins-modal .modal-body {
  max-height: min(70vh, 640px);
  overflow: auto;
}

.users-table {
  margin: 0;
}

.users-table th,
.users-table td {
  padding: 12px 14px;
  vertical-align: middle;
}

.users-table th.col-actions,
.users-table td.col-actions {
  text-align: right;
  white-space: nowrap;
}

.user-cell {
  display: grid;
  gap: 2px;
  min-width: 140px;
}

.user-display {
  font-weight: 700;
  color: var(--ink);
}

.user-username {
  font-size: 0.86rem;
  color: var(--muted);
}

.user-notes {
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-linked {
  color: var(--muted);
  font-size: 0.92rem;
}

.user-row-inactive {
  opacity: 0.72;
}

.role-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.role-pill {
  background: rgba(31, 111, 84, 0.12);
  color: var(--accent-deep);
  border: 1px solid rgba(31, 111, 84, 0.18);
}

.role-pill.role-admin {
  background: rgba(28, 42, 34, 0.1);
  color: var(--ink);
  border-color: rgba(28, 42, 34, 0.16);
}

.role-pill.role-principal {
  background: rgba(31, 111, 84, 0.14);
  color: var(--accent-deep);
}

.role-pill.role-teacher {
  background: rgba(138, 90, 18, 0.12);
  color: var(--warn);
  border-color: rgba(138, 90, 18, 0.2);
}

.role-pill.role-student {
  background: rgba(70, 100, 140, 0.12);
  color: #34507a;
  border-color: rgba(70, 100, 140, 0.2);
}

.status-pill.is-active {
  background: rgba(31, 111, 84, 0.12);
  color: var(--accent-deep);
}

.status-pill.is-inactive {
  background: rgba(143, 47, 47, 0.1);
  color: var(--danger);
}

@media (max-width: 720px) {
  .users-table th:nth-child(3),
  .users-table td:nth-child(3) {
    display: none;
  }
}

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

.login-shell {
  width: min(440px, 100%);
}

.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px 22px;
}

.login-brand {
  margin-bottom: 12px;
}

.login-brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2rem;
}

.login-lead {
  color: var(--muted);
  margin: 0 0 18px;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.92rem;
}

.login-error {
  color: var(--danger);
  margin: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.toolbar label.grow {
  flex: 1 1 220px;
  min-width: 180px;
}

.student-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.student-toolbar input,
.student-toolbar select,
.student-actions #student-count {
  font-weight: 500;
}

.student-actions {
  align-items: center;
}

.student-actions #student-count {
  margin-left: auto;
  color: var(--accent-deep);
}

#students-table .parent-cell {
  color: var(--muted);
  font-size: 0.92rem;
}

#students-table .row-selected {
  background: rgba(31, 111, 84, 0.08);
}

.view-toggle {
  min-width: 140px;
}

.status-box {
  padding: 14px 16px;
  margin-bottom: 14px;
  color: var(--warn);
}

.status-box.ok {
  color: var(--accent-deep);
}

.status-box ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.timetable-view {
  padding: 16px;
  overflow-x: auto;
}

.tt-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
}

.tt-grid {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

.tt-grid th,
.tt-grid td {
  border: 1px solid var(--line);
  padding: 10px;
  text-align: center;
  min-width: 100px;
}

.tt-grid th {
  background: #eef5ee;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.92rem;
  color: var(--ink);
}

.tt-cell {
  display: grid;
  gap: 2px;
}

.tt-cell .subj {
  font-weight: 700;
}

.tt-cell .who {
  font-size: 0.85rem;
  color: var(--muted);
}

.tt-cell.class-teacher {
  background: #e7f4ec;
}

.tt-empty {
  color: #9aa89e;
}

.storage-banner {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e2b46a;
  background: #fff6e8;
  color: #6a4a12;
  font-size: 0.92rem;
  line-height: 1.45;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.storage-banner.storage-banner-danger {
  border-color: #e0a090;
  background: #fff1ec;
  color: #7a2e1f;
}

.storage-banner[hidden] {
  display: none !important;
}

.storage-banner strong {
  font-weight: 700;
}

.backup-settings {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 50;
  max-width: min(360px, calc(100vw - 36px));
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-note {
    text-align: left;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar-note,
  .tabs,
  .subtabs,
  .sidebar,
  .sidebar-backdrop,
  .sidebar-toggle,
  .storage-banner,
  .toolbar,
  .status-box,
  .panel-head p,
  .toast,
  .print-many-card,
  .modal,
  .form-card,
  .proxy-load,
  .icon-btn,
  .dash-grid,
  .dash-actions {
    display: none !important;
  }

  .app-frame {
    display: block;
  }

  .app-content,
  .app-shell {
    max-width: none;
    padding: 0;
  }

  .timetable-view,
  .panel.active,
  .subpanel.active {
    display: block !important;
    box-shadow: none;
    border: none;
  }

  .panel:not(.active),
  .subpanel:not(.active) {
    display: none !important;
  }

  body.printing-batch .timetable-view {
    display: none !important;
  }

  body.printing-batch .print-batch {
    display: block !important;
  }

  .print-page {
    break-after: page;
    page-break-after: always;
  }

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

  .screen-only {
    display: none !important;
  }
}

/* Student expand + docs + import fix */
.doc-types-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0;
}
.doc-type-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: color-mix(in srgb, var(--panel) 92%, #fff);
}
.doc-type-card .form-grid {
  margin-top: 8px;
}
.doc-type-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
}
.student-expand-btn {
  min-width: 2rem;
}
.student-detail-row td {
  background: color-mix(in srgb, var(--accent) 6%, var(--panel));
  padding: 14px;
}
.student-profile {
  display: grid;
  gap: 14px;
  grid-template-columns: 140px 1fr;
}
@media (max-width: 720px) {
  .student-profile {
    grid-template-columns: 1fr;
  }
}
.student-photo-block {
  text-align: center;
}
.student-photo-preview {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
}
.student-photo-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 16px;
  border: 1px dashed var(--line);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 auto;
}
.student-docs-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.student-doc-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}
.student-doc-card h5 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}
.import-fix-row td {
  background: #f7fbf8;
}
.import-fix-grid {
  display: grid;
  gap: 8px 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  align-items: end;
}
.import-fix-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}

/* Portions */
.portion-stats { margin: 0 0 12px; }
.portion-toolbar { margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.portion-view-tabs { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.portion-table .portion-row { cursor: pointer; }
.portion-table .portion-row:hover { background: #f7faf8; }
.portion-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.portion-status-draft { background: #eef1f4; color: #445; }
.portion-status-submitted { background: #fff3d6; color: #8a5a00; }
.portion-status-returned { background: #fde8e6; color: #8b2e22; }
.portion-status-released { background: #e3f5ea; color: #1f5c38; }
.portion-status-missing { background: #f0e8ff; color: #5a3d8a; }
.portion-notifications {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.portion-note-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.portion-note {
  display: grid;
  gap: 2px;
  margin: 0 0 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.portion-dl {
  display: grid;
  gap: 8px 16px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin: 12px 0;
}
.portion-dl dt { font-size: 0.78rem; color: var(--muted); margin: 0; }
.portion-dl dd { margin: 2px 0 0; font-weight: 600; }
.portion-pre {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #f7f5f0;
  border: 1px solid #e5dfd3;
  border-radius: 10px;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.92rem;
}
.portion-return-box { margin-top: 12px; }
.portion-return-reason {
  margin: 12px 0;
  padding: 10px 12px;
  background: #fff7f2;
  border: 1px solid #e0a090;
  border-radius: 10px;
}
.portion-history-list { margin: 0; padding-left: 1.2rem; }
.portion-detail-meta { display: flex; gap: 10px; align-items: center; }
.admin-pager {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
#user-filters .grow,
#teacher-filters .grow {
  grid-column: span 2;
}
@media (max-width: 720px) {
  #user-filters .grow,
  #teacher-filters .grow {
    grid-column: span 1;
  }
}
.users-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.users-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.users-add-menu { margin-bottom: 12px; }
.user-stats { margin: 0 0 12px; }
.users-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 12px;
}
.users-search { min-width: min(280px, 100%); flex: 1 1 220px; }
.users-search input { width: 100%; }
.users-role-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--primary, #1f6f54) 18%, white);
  color: var(--primary, #1f6f54);
  flex: 0 0 auto;
}
.user-cell-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.user-menu {
  position: relative;
  display: inline-block;
}
.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  z-index: 20;
  padding: 4px;
  display: grid;
}
.user-menu-panel button {
  background: none;
  border: 0;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 6px;
  font: inherit;
}
.user-menu-panel button:hover { background: #f3f4f6; }
.user-menu-panel button.danger { color: #b42318; }
.user-temp-pw {
  display: block;
  padding: 10px 12px;
  background: #f8faf9;
  border-radius: 8px;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  user-select: all;
}
.users-table th[data-user-sort] { cursor: pointer; }
@media (max-width: 900px) {
  .users-table th:nth-child(7),
  .users-table td:nth-child(7) { display: none; }
}

.dash-portion-summary { margin-top: 14px; }
.dash-portion-panels {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.dash-portion-panel-title {
  margin: 0 0 6px;
  font-size: 0.85rem;
  font-weight: 600;
}
.dash-portion-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.dash-portion-list li {
  font-size: 0.86rem;
  line-height: 1.35;
  color: var(--text, #1f2937);
}
.dash-portion-list button.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.portion-history-versions { margin-top: 10px; }
.portion-history-versions details {
  margin: 6px 0;
  padding: 6px 8px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
}
.portion-history-versions summary {
  cursor: pointer;
  font-weight: 600;
}
#portion-edit-modal .modal-body,
#portion-detail-modal .modal-body {
  max-height: min(70vh, 640px);
  overflow: auto;
}

/* Exams */
.exam-conflicts {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #e0a090;
  background: #fff7f2;
  border-radius: 12px;
}
.exam-papers-editor { display: grid; gap: 10px; margin-bottom: 8px; }
.exam-paper-row {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.exam-readiness {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.exam-schedule-editor {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.exam-calendar-list { display: grid; gap: 8px; }
.exam-cal-item {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.exam-status-draft { background: #eef1f4; color: #445; }
.exam-status-published { background: #e7f0ff; color: #1e4b8c; }
.exam-status-ongoing { background: #fff3d6; color: #8a5a00; }
.exam-status-completed { background: #e3f5ea; color: #1f5c38; }
.exam-status-archived { background: #f0eef2; color: #666; }
#exam-edit-modal .modal-body,
#exam-detail-modal .modal-body {
  max-height: min(70vh, 640px);
  overflow: auto;
}

/* Homework / class assignments */
.hw-section { margin: 16px 0 20px; }
.hw-section-title {
  margin: 0 0 10px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
}
.hw-card-list {
  display: grid;
  gap: 10px;
}
.hw-card {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff 0%, #f7faf8 100%);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.hw-card:hover {
  border-color: #1f6f54;
  transform: translateY(-1px);
}
.hw-card.is-overdue {
  border-color: #d9a39a;
  background: linear-gradient(180deg, #fff 0%, #fdf6f4 100%);
}
.hw-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.hw-card-subject {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #1f6f54;
}
.hw-card-title {
  font-size: 1.05rem;
}
.hw-card-due {
  font-weight: 600;
  color: #355;
}
.hw-due-soon { font-weight: 700; color: #1f6f54; }
.hw-due-overdue { font-weight: 700; color: #8b2e22; }
.hw-status-draft { background: #eef1f4; color: #445; }
.hw-status-published { background: #e3f5ea; color: #1f5c38; }
.hw-status-closed { background: #e7f0ff; color: #1e4b8c; }
.hw-status-archived { background: #f0eef2; color: #666; }
.hw-status-not_started { background: #eef1f4; color: #445; }
.hw-status-submitted { background: #e7f0ff; color: #1e4b8c; }
.hw-status-overdue { background: #fde8e6; color: #8b2e22; }
.hw-status-completed { background: #e3f5ea; color: #1f5c38; }
.hw-status-late { background: #fff3d6; color: #8a5a00; }
.hw-status-reviewed { background: #e3f5ea; color: #1f5c38; }
#hw-edit-modal .modal-body,
#hw-detail-modal .modal-body {
  max-height: min(70vh, 640px);
  overflow: auto;
}
#panel-homework.hw-role-student #hw-bulk-bar,
#panel-homework.hw-role-student #hw-f-class-wrap,
#panel-homework.hw-role-student #hw-f-status-wrap,
#panel-homework.hw-role-staff #hw-quick-filters,
#panel-homework.hw-role-staff #hw-f-student-status-wrap {
  display: none !important;
}
@media (min-width: 720px) {
  .hw-card-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
