/* app.css (v18) - clean, minimal overrides on top of Bulma
   Goal: stable layout (sidebar + content), readable whitespace, no accumulated legacy rules.
*/

/* --- Base --- */
:root {
  --navbar-h: 52px;
  --footer-h: 41.5px;
  --sidebar-w: 300px;
  --gutter: 28px;
  --page-pad-x: 32px;
  --page-pad-y: 24px;
  --content-max: 1100px;
  --content-max-admin: 1050px;
  --border: #e6e6e6;
  --sidebar-bg: #f2f7ef;
  --app-bg: #f4f7f2;
  --app-surface: #ffffff;
  --app-surface-soft: #fbfdf8;
  --app-border-soft: #dbe7d7;
  --app-text: #26333f;
  --landing-brand: #2f6f5e;
  --landing-brand-dark: #244f44;
  --landing-accent: #f4b942;
  --landing-surface: #fff8ea;
  --landing-ink: #253340;
}

html {
  height: 100%;
}
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--app-bg);
  color: var(--app-text);
}
.navbar {
  border-bottom: 1px solid var(--app-border-soft);
  background: linear-gradient(180deg, #fbfdf8 0%, #f3f8f1 100%);
}
.navbar .navbar-item,
.navbar a.navbar-item {
  color: #31424f;
}
.navbar .navbar-item strong {
  color: var(--landing-brand-dark);
}
.icon-text {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.icon-text .icon {
  font-size: 1.05em;
  line-height: 1;
}
.edu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  border: 1px solid #cfe0c9;
  background: #ecf5e8;
  color: var(--landing-brand-dark);
  font-size: 0.95rem;
  line-height: 1;
}
.edu-icon i {
  line-height: 1;
}
.edu-icon--heading {
  width: 1.95rem;
  height: 1.95rem;
  font-size: 1rem;
}
.edu-icon--sidebar {
  width: 1.5rem;
  height: 1.5rem;
  font-size: 0.85rem;
}
.edu-icon--soft {
  background: rgba(255, 255, 255, 0.9);
  border-color: #d7e5d2;
}

/* --- Layout wrapper --- */
.page-wrap {
  flex: 1;
  min-height: calc(100vh - var(--navbar-h) - var(--footer-h));
  font-size: 14px;
}

/* Mail layout: sidebar + main */
.layout-columns {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - var(--navbar-h) - var(--footer-h));
}

.layout-sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
}

.sidebar-inner {
  padding: 16px;
  position: sticky;
  top: var(--navbar-h);
  height: calc(100vh - var(--navbar-h) - var(--footer-h));
  overflow: auto;
}

.footer {
  border-top: 1px solid var(--app-border-soft);
  background: #f7faf5;
}

.footer__credits {
  font-size: 0.75rem;
  color: #555;
}
/* Main content area */
.layout-main {
  flex: 1 1 auto;
  padding: var(--page-pad-y) var(--page-pad-x);
  /* whitespace between sidebar and content */
  padding-left: calc(var(--page-pad-x) + var(--gutter));
}

.layout-main.no-sidebar {
  padding: calc(var(--page-pad-y) + 6px) calc(var(--page-pad-x) + 8px);
}

.main-inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

.layout-main.no-sidebar .main-inner {
  max-width: var(--content-max-admin);
}

/* --- Rhythm / spacing --- */
.main-inner > .title {
  margin-bottom: 0.75rem;
}
.main-inner > .subtitle {
  margin-top: -0.25rem;
  margin-bottom: 1rem;
}

.box {
  padding: 1.25rem;
  background: var(--app-surface);
  border: 1px solid var(--app-border-soft);
  border-radius: 12px;
  box-shadow: 0 5px 16px rgba(56, 81, 58, 0.06);
}
.box + .box {
  margin-top: 1.25rem;
}

/* --- Admin page --- */
.admin-head {
  gap: 1rem;
  flex-wrap: wrap;
}
.admin-head .level-right {
  gap: 0.75rem;
  flex-wrap: wrap;
}
.admin-head .level-right {
  align-items: center;
  justify-content: flex-end;
}
.tags .tag {
  margin-bottom: 0;
}
.teacher-summary {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid #dbe8d6;
  border-radius: 10px;
  background: var(--app-surface-soft);
  width: auto;
  max-width: 100%;
}
.teacher-summary .teacher-summary__item {
  margin: 0;
  flex: 0 0 auto;
}
.admin-head .level-right .tags {
  margin-bottom: 0;
}
.teacher-page .admin-head {
  align-items: flex-start;
  flex-wrap: nowrap;
}
.teacher-page .admin-head .level-left {
  flex: 1 1 auto;
  min-width: 0;
}
.teacher-page .admin-head .level-right.teacher-summary {
  flex: 0 0 auto;
  margin-left: auto;
  align-self: flex-start;
}
.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.admin-panel {
  border: 1px solid var(--app-border-soft);
  border-radius: 8px;
  padding: 1.25rem;
  background: var(--app-surface);
}
.admin-panel + .admin-panel {
  margin-top: 1.25rem;
}
.admin-grid .admin-panel + .admin-panel {
  margin-top: 0;
}
.admin-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 0.75rem;
}
.admin-panel__head .title {
  margin-bottom: 0;
}
.admin-panel__body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.admin-panel > summary {
  list-style: none;
  cursor: pointer;
}
.admin-panel > summary::-webkit-details-marker {
  display: none;
}
.admin-panel[open] > summary {
  margin-bottom: 0.75rem;
}
.admin-filter {
  margin-bottom: 0.75rem;
}
.admin-filter .field.is-grouped {
  flex-wrap: wrap;
  gap: 0.75rem;
}
.admin-filter .field.is-grouped .control {
  margin-right: 0;
}
.teacher-page .admin-panel {
  margin-bottom: 1.25rem;
}
.teacher-page .admin-panel:last-of-type {
  margin-bottom: 0;
}
.teacher-page .admin-panel__body .columns {
  margin-bottom: 0;
}
.teacher-page .admin-panel__body .buttons {
  margin-top: 0.5rem;
  gap: 0.5rem;
}
.alias-panel {
  gap: 0.9rem;
}
.alias-section {
  border: 1px solid #e3ebe0;
  border-radius: 10px;
  padding: 1rem;
  background: #fcfdfb;
}
.alias-section__title {
  margin-bottom: 0.25rem !important;
}
.alias-section__help {
  margin-top: 0;
  margin-bottom: 0.85rem !important;
}
.alias-create-form .field {
  margin-bottom: 0.75rem;
}
.alias-create-form .alias-address-row {
  align-items: end;
  margin-bottom: 0.75rem;
}
.alias-at {
  align-self: end;
  font-weight: 700;
  color: #4f6559;
  line-height: 1;
}
.alias-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.alias-list .table {
  margin-bottom: 0;
}
.alias-list td {
  vertical-align: middle;
}
.alias-update-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(300px, 1.2fr) auto auto;
  gap: 0.55rem 0.75rem;
  align-items: center;
}
.alias-update-form .input.is-small {
  width: 100%;
}
.alias-update-form__address {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) auto minmax(140px, 1fr);
  align-items: center;
  gap: 0.45rem;
}
.alias-update-form__at {
  font-weight: 700;
  color: #4f6559;
  line-height: 1;
}
.alias-update-form__addressbook {
  white-space: nowrap;
}
.alias-update-form__checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.alias-update-form__save .button {
  min-width: 5.75rem;
}
.alias-delete-cell {
  white-space: nowrap;
}
.alias-delete-form {
  display: inline-flex;
  justify-content: center;
}
@media screen and (max-width: 1100px) {
  .alias-update-form {
    grid-template-columns: 1fr 1fr;
  }
  .alias-update-form__address {
    grid-column: 1 / -1;
  }
  .alias-update-form__addressbook,
  .alias-update-form__save {
    grid-column: auto;
  }
}
.send-window-grid .column {
  display: flex;
}
.send-window-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
  height: 100%;
}
.send-window-card .field {
  margin-bottom: 0;
}
.send-window-time {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid #d9e7ff;
  background: #f2f7ff;
  color: #1b3b6f;
  display: grid;
  gap: 0.2rem;
}
.send-window-time__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
  color: #3d5a86;
}
.send-window-time__value {
  font-weight: 700;
  font-size: 1rem;
}
.send-window-time__value span[data-open-countdown] {
  font-weight: 600;
  color: #274c77;
}
.send-window-time--closed {
  border-color: #f0d8d8;
  background: #fff5f5;
  color: #842029;
}
.send-window-time--closed .send-window-time__label {
  color: #a33a3a;
}
.send-window-action {
  margin-top: auto;
}
.admin-import details summary {
  cursor: pointer;
}
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.admin-form__row {
  display: grid;
  gap: 0.75rem 1rem;
  align-items: end;
}
.admin-form__row--auto {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.admin-form__row--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.admin-form__row--split {
  grid-template-columns: minmax(0, 1fr) auto;
}
.admin-form__row > .field {
  min-width: 0;
}
.admin-form__row .field.is-flex {
  align-self: end;
}
.admin-form__row .input,
.admin-form__row .select,
.admin-form__row .control {
  width: 100%;
  max-width: 100%;
}
.admin-form__row .select select {
  width: 100%;
  max-width: 100%;
}
.admin-form__actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  justify-content: flex-start;
  align-self: flex-start;
  width: auto;
}
.admin-form__actions .button {
  width: auto;
}
.admin-table-actions {
  min-width: 240px;
  vertical-align: middle;
}
.admin-table-actions > * {
  display: block;
}
.admin-table-actions > * + * {
  margin-top: 0.75rem;
}
.admin-table-actions .button {
  width: auto;
}
.admin-inline-form .field.is-grouped,
.admin-inline-form .field.is-grouped-multiline {
  flex-wrap: wrap;
  margin-bottom: 0;
}
.admin-inline-form .input.is-small {
  min-width: 120px;
}
.admin-inline-form .select.is-small {
  min-width: 140px;
}
.table .actions-col {
  min-width: 240px;
}
.inline-edit {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.inline-edit--full {
  width: 100%;
}
.inline-edit--full .inline-edit__trigger {
  width: 100%;
  text-align: left;
}
.inline-edit--full .inline-edit__editor {
  width: 100%;
}
.inline-edit--full .inline-edit__input {
  flex: 1 1 auto;
  min-width: 140px;
  max-width: none;
}
.inline-edit__trigger {
  background: none;
  border: none;
  padding: 0;
  color: #3273dc;
  cursor: pointer;
  font-weight: 600;
}
.inline-edit__trigger:hover {
  text-decoration: underline;
}
.inline-edit__editor {
  display: none;
  align-items: center;
  gap: 0.5rem;
}
.inline-edit.is-editing .inline-edit__trigger {
  display: none;
}
.inline-edit.is-editing .inline-edit__editor {
  display: inline-flex;
}
.inline-edit__input {
  max-width: 220px;
}
.action-icon {
  min-width: 2.2rem;
  padding: 0.2rem 0.5rem;
  line-height: 1.1;
  text-align: center;
}
.admin-form__section {
  border: 1px solid #e1e9dd;
  border-radius: 8px;
  padding: 1rem;
  background: var(--app-surface-soft);
  margin-bottom: 1rem;
}
.admin-form__section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.admin-form__section-head .title {
  margin-bottom: 0;
}
.admin-form__grid {
  display: grid;
  gap: 0.75rem 1rem;
  align-items: stretch;
}
.admin-form__grid > .field {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.admin-form__grid .input,
.admin-form__grid .select,
.admin-form__grid .control {
  width: 100%;
  max-width: 100%;
}
.admin-form__grid .select select {
  width: 100%;
  max-width: 100%;
}
.admin-form__grid--three {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.auto-range-row {
  gap: 0.75rem;
}

.auto-range {
  width: 100%;
}

.auto-range-value {
  min-width: 3.5rem;
  text-align: center;
}

.auto-range-number {
  max-width: 6rem;
}

.auto-percent-input .input {
  min-width: 5rem;
}

.generator-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.75rem 0;
}

.generator-wrapper {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  background: #fff;
}

.generator-wrapper .admin-panel {
  border: none;
  padding: 0;
}

.generator-wrapper .admin-panel + .admin-panel {
  margin-top: 0;
}
.generator-rules-preview {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr);
  gap: 0.75rem;
}
.generator-rules-preview .field:last-child {
  grid-column: 1 / -1;
}
@media (max-width: 900px) {
  .generator-rules-preview {
    grid-template-columns: 1fr;
  }
}
.generator-wrapper.is-disabled {
  opacity: 0.6;
  pointer-events: none;
}

.generator-wrapper:not(.is-advanced) [data-advanced] {
  display: none;
}

.generator-wrapper:not(.is-advanced) .region-weights {
  display: none;
}

.region-row {
  gap: 0.5rem;
}

.region-row .checkbox {
  margin-bottom: 0.25rem;
}
.region-counts {
  display: grid;
  gap: 0.5rem;
}
.region-counts__head,
.region-counts__row {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) repeat(3, minmax(90px, 1fr));
  gap: 0.5rem;
  align-items: center;
}
.region-counts__head {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
}
.region-counts__label {
  font-weight: 600;
}
.generator-help ul {
  margin-left: 1rem;
}
.generator-help li {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}
.generator-help .icon {
  margin-top: 0.1rem;
  color: var(--primary);
}
.generator-row-actions .button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
[data-generated-body] tr.is-selected {
  background: rgba(46, 204, 113, 0.08);
}
[data-generated-body] td,
[data-generated-body] th {
  vertical-align: middle;
}
.generator-row-actions {
  align-items: center;
}
[data-edit-cell] {
  cursor: text;
}
[data-edit-cell] .edit-value {
  display: inline-block;
}
[data-edit-cell] .input {
  width: 100%;
}
.input.is-static {
  padding-left: 0.5rem;
  cursor: default;
  box-shadow: none;
  border-color: var(--border);
  background: #f7f7f7;
}
.generator-compact .field .help {
  margin-top: 0.2rem;
}
.generator-compact .field {
  margin-bottom: 0.5rem;
}
.generator-compact .input {
  width: 220px;
  max-width: 100%;
}
.generator-row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
}
.generator-action-icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  justify-content: center;
}
.generator-confirm-actions {
  justify-content: flex-end;
}
.label.is-placeholder {
  visibility: hidden;
}
.admin-form__grid--two {
  grid-template-columns: minmax(0, 1fr) auto;
}
.admin-form__grid--two .field.is-flex {
  align-items: flex-end;
}
.admin-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem 1rem;
}
.admin-checkbox-grid .checkbox {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}
.teacher-edit {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.admin-form__note {
  border: 1px dashed #d8d8d8;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  background: #fff;
  color: #555;
  font-size: 0.92rem;
}
.toast-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(90vw, 520px);
  pointer-events: none;
}
.toast {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
}
.toast--show {
  opacity: 1;
  transform: translateY(0);
}
.toast--hide {
  opacity: 0;
  transform: translateY(8px);
}

hr {
  margin: 1.25rem 0;
}

.field:not(:last-child) {
  margin-bottom: 0.9rem;
}

.button + .button {
  margin-left: 0.5rem;
}
.login-role-hint p {
  line-height: 1.35;
}

/* --- Landing --- */
.landing-page {
  display: grid;
  gap: 1.5rem;
  font-family: "Nunito", "Segoe UI", sans-serif;
  color: var(--landing-ink);
}
.landing-hero {
  position: relative;
  border: 1px solid #dbe8d7;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(
      circle at 88% 18%,
      rgba(244, 185, 66, 0.18),
      transparent 42%
    ),
    linear-gradient(135deg, #fff8ea 0%, #eef8f1 50%, #e9f2ff 100%);
  color: var(--landing-ink);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 1.8rem;
  padding: clamp(1.6rem, 3vw, 2.9rem);
  box-shadow: 0 10px 28px rgba(56, 81, 58, 0.12);
}
.landing-hero::before {
  content: "";
  position: absolute;
  inset: auto -120px -140px auto;
  width: 300px;
  height: 300px;
  border-radius: 50% 50% 0 50%;
  background: rgba(47, 111, 94, 0.08);
  pointer-events: none;
}
.landing-hero__content,
.landing-hero__highlights {
  position: relative;
  z-index: 1;
}
.landing-hero__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.landing-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid #d3e3cb;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  padding: 0.35rem 0.72rem;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 1rem;
  color: var(--landing-brand-dark);
}
.landing-hero__title,
.landing-hero__subtitle {
  color: var(--landing-ink) !important;
}
.landing-hero__title {
  max-width: 22ch;
  margin-bottom: 1.15rem !important;
  letter-spacing: 0.01em;
}
.landing-hero__subtitle {
  max-width: 55ch;
  color: #3f5468 !important;
  line-height: 1.5;
  margin-bottom: 1.85rem !important;
}
.landing-student-notes {
  width: 100%;
  max-width: 560px;
  border: 1px solid #d7e5d2;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  padding: 0.75rem 0.85rem;
  margin-bottom: 1.05rem;
}
.landing-student-notes__title {
  margin: 0 0 0.45rem;
  font-weight: 800;
  font-size: 0.95rem;
  color: #365347;
}
.landing-student-notes__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.42rem;
}
.landing-student-notes__list li {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 0.45rem;
  color: #3f5468;
  line-height: 1.45;
}
.landing-hero__actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: flex-start;
}
.landing-hero__actions .button + .button {
  margin-left: 0;
}
.landing-hero__actions .button {
  border-radius: 12px;
  font-weight: 700;
}
.landing-hero__actions .button.is-link {
  background: var(--landing-brand);
  border-color: var(--landing-brand);
}
.landing-hero__actions .button.is-link:hover {
  background: var(--landing-brand-dark);
  border-color: var(--landing-brand-dark);
}
.landing-hero__actions .button.is-light {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #c8d8c2;
  color: #365347;
}
.landing-hero__actions .button.is-light:hover {
  background: #fff;
}
.landing-hero__staff-btn {
  font-size: 0.95rem;
  padding-left: 0.95rem;
  padding-right: 0.95rem;
  min-height: 2.15em;
  margin-top: 0.1rem;
}
.landing-highlight {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid #d7e5d2;
  border-left: 4px solid #a4c79b;
  border-radius: 12px;
  padding: 1rem 1rem;
  box-shadow: 0 4px 10px rgba(63, 94, 62, 0.08);
}
.landing-highlight + .landing-highlight {
  margin-top: 0.8rem;
}
.landing-highlight .icon {
  font-size: 1rem;
}
.landing-highlight__title {
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: #2d4238;
}
.landing-highlight__text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #425768;
}
.landing-section {
  border: 1px solid #dbe7da;
  border-radius: 18px;
  background: #fffef9;
  padding: clamp(1rem, 2.1vw, 1.7rem);
}
.landing-section--muted {
  background: #f6faf6;
  border-color: #dce8da;
}
.landing-section--accent {
  background: linear-gradient(165deg, #fffefb 0%, var(--landing-surface) 100%);
}
.landing-section__head .subtitle {
  color: #4c6155;
  max-width: 64ch;
}
.landing-section__head {
  margin-bottom: 1rem;
}
.landing-section__head .title {
  margin-bottom: 0.4rem !important;
}
.landing-section__subtitle {
  margin: 0.15rem 0 0;
  color: #4c6155;
  font-size: 1rem;
  line-height: 1.45;
  max-width: 64ch;
}
.landing-role-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}
.landing-student-card {
  border: 1px solid #d4e3cf;
  border-radius: 16px;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(227, 236, 226, 0.45) 0,
      rgba(227, 236, 226, 0.45) 1px,
      transparent 1px,
      transparent 30px
    ),
    #ffffff;
  color: var(--landing-ink);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  box-shadow: 0 6px 16px rgba(72, 97, 70, 0.08);
}
.landing-student-card .title {
  margin-bottom: 0.45rem !important;
}
.landing-student-card p {
  line-height: 1.5;
}
.landing-student-card .button {
  align-self: flex-start;
  margin-top: 0.4rem;
}
.landing-staff-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}
.landing-staff-details {
  border: 1px dashed #c6d9c1;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
  padding: 0.65rem 0.85rem;
}
.landing-staff-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}
.landing-staff-summary::-webkit-details-marker {
  display: none;
}
.landing-staff-summary__title {
  font-weight: 800;
  color: #30463d;
}
.landing-staff-summary__hint {
  font-size: 0.86rem;
  color: #60746b;
}
.landing-staff-summary::after {
  content: "▾";
  color: #5d7268;
  font-size: 1rem;
}
.landing-staff-details[open] .landing-staff-summary::after {
  content: "▴";
}
.landing-staff-details__body {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.85rem;
}
.landing-role-card {
  border: 1px solid #d8e5d5;
  border-radius: 16px;
  background: #fff;
  color: var(--landing-ink);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition:
    transform 200ms ease,
    box-shadow 200ms ease,
    border-color 200ms ease;
}
.landing-role-card:hover {
  border-color: #bdd2b7;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(72, 97, 70, 0.1);
}
.landing-role-card.is-selected {
  border-color: var(--landing-brand);
  box-shadow: 0 0 0 1px rgba(47, 111, 94, 0.16);
}
.landing-role-card--secondary {
  background: #fcfefb;
  border-color: #d8e5d5;
}
.landing-role-card__icon {
  display: inline-flex;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  background: #eef6ea;
  color: var(--landing-brand-dark);
  font-size: 1.22rem;
}
.landing-role-card__format {
  font-size: 0.86rem;
  color: #4c6155;
  margin-top: 0.35rem;
}
.landing-role-card .button {
  margin-top: auto;
  align-self: flex-start;
  border-radius: 10px;
}
.landing-role-card p {
  line-height: 1.45;
}
.landing-role-card .button.is-outlined.is-link {
  color: #3a6356;
  border-color: #97baac;
}
.landing-role-card .button.is-outlined.is-link:hover {
  color: #fff;
  background: #4c7f70;
  border-color: #4c7f70;
}
.landing-access-box {
  border: 1px dashed #c9dcbf;
  border-radius: 14px;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.92);
}
.landing-access-box p {
  line-height: 1.5;
}

.landing-access-box .button {
  height: 1.5em;
}
@keyframes landing-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tables: keep them readable */
.table-wrap {
  overflow: auto;
  border: 1px solid #e3ebe0;
  border-radius: 10px;
  background: #fff;
}
.table-wrap--logs {
  width: 100%;
  margin: 0.5rem 0.5rem 0;
}
.logs-table th,
.logs-table td {
  white-space: nowrap;
}
.mail-list .mail-row {
  cursor: pointer;
  transition:
    background-color 140ms ease,
    color 140ms ease;
}
.mail-list .mail-row.is-unread td {
  font-weight: 700;
  color: #263d37;
}
.mail-list .mail-row.is-unread .mail-snippet {
  font-weight: 600;
}
.mail-list .mail-row:hover {
  background: #eef6ea !important;
}
.mail-list .mail-row:hover td {
  color: #223932;
}
.mail-list tbody tr + tr td {
  border-top: 1px solid #edf3ea;
}
.mail-list .mail-snippet {
  color: #5d7268;
}
.mail-list th {
  color: #51645b;
  font-weight: 700;
}
.sidebar-alias {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.sidebar-link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}
.sidebar-alias-link {
  display: flex !important;
  align-items: flex-start;
  gap: 0.45rem;
}
.sidebar-alias-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}
.sidebar-alias-link__icon {
  line-height: 1;
  margin-top: 0.02rem;
  opacity: 0.85;
}
.sidebar-alias__name {
  font-size: 0.84rem;
  font-weight: 600;
  word-break: break-word;
}
.sidebar-alias__address {
  font-size: 0.7rem;
  opacity: 0.7;
  word-break: break-word;
}
.sidebar-unread-badge {
  margin-left: auto;
  min-width: 1.7rem;
  justify-content: center;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
}
.sidebar-unread-badge.tag.is-info.is-light {
  background: #e5f2e2;
  color: #2f5a46;
}
.layout-sidebar .menu {
  background: linear-gradient(180deg, #f8fcf6 0%, #f0f7ed 100%);
  border: 1px solid #dbe8d7;
  border-radius: 12px;
  padding: 0.85rem;
}
.layout-sidebar .menu-label {
  color: #617562;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 0.45rem;
}
.layout-sidebar .menu-label:not(:first-child) {
  margin-top: 1rem;
}
.layout-sidebar .menu-list a {
  border-radius: 10px;
  border: 1px solid transparent;
  color: #344a45;
  padding: 0.55rem 0.65rem;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}
.layout-sidebar .menu-list a:hover {
  background: #edf6ea;
  border-color: #d2e2cd;
}
.layout-sidebar .menu-list a.is-active {
  background: #e3f0e0;
  border-color: #bfd4b8;
  color: #244236;
}
.table {
  margin-bottom: 0;
}
.table thead th {
  position: sticky;
  top: 0;
  background: #f8fbf6;
  z-index: 1;
}
.mail-list td,
.mail-list th {
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

/* --- Compose form: ensure spacing between columns --- */
.compose-grid .columns {
  margin-left: -0.5rem;
  margin-right: -0.5rem;
}
.compose-grid .column {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

/* --- Theme bridge (landing -> app) --- */
.button.is-link {
  background-color: var(--landing-brand);
  border-color: var(--landing-brand);
}
.button.is-link:hover,
.button.is-link:focus {
  background-color: var(--landing-brand-dark);
  border-color: var(--landing-brand-dark);
}
.button.is-light {
  background-color: #f6faf4;
  border-color: #d0dfcc;
  color: #385548;
}
.button.is-light:hover,
.button.is-light:focus {
  background-color: #ffffff;
  border-color: #bfd1b9;
}
.input,
.textarea,
.select select {
  border-color: #d1ddcd;
}
.input:focus,
.input:focus-visible,
.textarea:focus,
.textarea:focus-visible,
.select select:focus,
.select select:focus-visible {
  border-color: var(--landing-brand);
  box-shadow: 0 0 0 0.125em rgba(47, 111, 94, 0.2);
}

/* --- Mail view --- */
.mail-view__subject,
.mail-view__meta {
  word-break: break-word;
}
.mail-view__header {
  flex-wrap: wrap;
  row-gap: 0.5rem;
  align-items: flex-start;
}
.mail-view__actions .buttons {
  flex-wrap: wrap;
  gap: 0.5rem;
}
.mail-view__actions .button + .button {
  margin-left: 0;
}
.mail-view__actions form {
  margin: 0;
}
.mail-view__meta {
  display: grid;
  row-gap: 0.6rem;
}
.mail-view__meta-row {
  display: grid;
  grid-template-columns: 84px 1fr;
  column-gap: 0.75rem;
  align-items: start;
}
.mail-view__meta-label {
  font-weight: 600;
  color: #666;
  text-transform: none;
}
.mail-view__meta-value {
  color: #222;
}
.mail-view__meta-details {
  padding-top: 0.25rem;
}
.mail-view__meta-details > summary {
  cursor: pointer;
  font-weight: 600;
  color: #333;
  list-style: none;
}
.mail-view__meta-details > summary::-webkit-details-marker {
  display: none;
}
.mail-view__meta-details > summary::after {
  content: "▾";
  margin-left: 0.35rem;
  font-size: 0.9em;
}
.mail-view__meta-details[open] > summary::after {
  content: "▴";
}
.mail-view__meta-details .mail-view__meta-row {
  margin-top: 0.6rem;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  :root {
    --sidebar-w: 260px;
    --gutter: 18px;
    --page-pad-x: 20px;
    --page-pad-y: 18px;
  }
}

@media (max-width: 930px) {
  .mail-view__meta-row {
    grid-template-columns: 64px 1fr;
  }
}

@media (max-width: 576px) {
  .mail-view__header {
    display: block;
  }
  .mail-view__header .level-right {
    margin-top: 0.75rem;
  }
  .mail-view__actions .buttons {
    display: block;
  }
  .mail-view__actions .button {
    width: 100%;
    justify-content: center;
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 0.5rem;
  }
  .mail-view__actions .button:last-child {
    margin-bottom: 0;
  }
}

@media (max-width: 900px) {
  .layout-columns {
    display: block;
  }
  .layout-sidebar {
    width: auto;
    max-width: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-inner {
    position: static;
    height: auto;
  }
  .layout-main {
    padding-left: var(--page-pad-x);
  }
  .main-inner {
    max-width: none;
  }

  .mail-view__meta-row {
    grid-template-columns: 1fr;
  }
  .mail-view__meta-label {
    font-size: 0.85rem;
  }
}

@media (max-width: 640px) {
  .admin-form__grid--three,
  .admin-form__grid--two {
    grid-template-columns: 1fr;
  }
  .admin-form__row--three,
  .admin-form__row--split {
    grid-template-columns: 1fr;
  }
  .landing-role-grid {
    grid-template-columns: 1fr;
  }
  .landing-staff-grid {
    grid-template-columns: 1fr;
  }
  .landing-hero__title {
    font-size: 1.85rem !important;
    line-height: 1.2;
  }
  .landing-hero__subtitle,
  .landing-section__subtitle,
  .landing-student-notes__list li {
    font-size: 1rem;
    line-height: 1.52;
  }
  .landing-hero__actions .button,
  .landing-student-card .button {
    min-height: 2.7rem;
    font-size: 1rem;
    width: 100%;
    justify-content: center;
  }
  .landing-role-card .button,
  .landing-access-box .button {
    min-height: 2.7rem;
    width: 100%;
    justify-content: center;
  }
  .layout-sidebar .menu-list a {
    padding: 0.7rem 0.75rem;
    font-size: 0.98rem;
  }
  .landing-staff-summary {
    align-items: flex-start;
    flex-direction: column;
  }
  .landing-staff-summary::after {
    align-self: flex-end;
    margin-top: -1.1rem;
  }
}

@media (max-width: 900px) {
  .landing-hero {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1240px) {
  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-panel--wide {
    grid-column: 1 / -1;
  }
}

@media screen and (max-width: 768px) {
  .teacher-page .admin-head {
    flex-wrap: wrap;
  }
  .teacher-page .admin-head .level-right.teacher-summary {
    margin-left: 0;
    justify-content: flex-start;
  }
  .teacher-summary {
    width: 100%;
    justify-content: flex-start !important;
  }
  .alias-actions .button {
    width: 100%;
  }
}

@media (min-width: 1440px) {
  .admin-form__grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
