.curator-records-root,
.student-documents-root {
  display: grid;
  gap: 20px;
  min-width: 0;
  max-width: 100%;
}

html,
body,
.layout {
  max-width: 100%;
  overflow-x: hidden;
}

.main,
.content,
.view,
.records-panel,
[data-student-document-content] {
  min-width: 0;
  max-width: 100%;
}

.main {
  overflow-x: hidden;
}

.topbar {
  inset-inline: 0;
  width: 100%;
  max-width: 100%;
}

.curator-records-root.hidden,
.student-documents-root.hidden,
.student-registry-legacy.hidden,
.legacy-journal-block.hidden {
  display: none !important;
}

.records-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface) 58%),
    var(--surface);
  box-shadow: var(--shadow);
}

.records-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.records-hero h2,
.records-section-head h2,
.records-section-head h3 {
  margin: 0;
  font-family: "Unbounded", sans-serif;
  line-height: 1.3;
}

.records-hero h2 {
  font-size: clamp(20px, 2.5vw, 30px);
}

.records-hero p,
.records-section-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.records-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.records-note {
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--warning) 32%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--warning-light) 80%, var(--surface));
  color: var(--text);
  font-size: 13px;
}

.attendance-months {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.attendance-month-card,
.student-document-card {
  position: relative;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.attendance-month-card {
  display: grid;
  gap: 6px;
  padding: 16px;
}

.attendance-month-card:hover,
.student-document-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow-hover);
}

.attendance-month-card.active,
.student-document-card.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-light) 72%, var(--surface));
}

.attendance-month-index {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}

.attendance-month-card strong {
  font-size: 15px;
}

.attendance-month-card small {
  color: var(--muted);
}

.records-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.records-metric {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-soft);
}

.records-metric span,
.records-metric small {
  display: block;
  color: var(--muted);
}

.records-metric strong {
  display: block;
  margin: 4px 0;
  color: var(--accent);
  font-family: "Unbounded", sans-serif;
  font-size: 24px;
}

.records-panel {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.records-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.records-section-head h2 {
  font-size: 19px;
}

.records-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  overscroll-behavior-inline: contain;
}

.attendance-table,
.records-data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.attendance-table {
  min-width: 1700px;
  table-layout: fixed;
}

.attendance-table th,
.attendance-table td,
.records-data-table th,
.records-data-table td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  vertical-align: middle;
}

.attendance-table th,
.records-data-table th {
  padding: 10px 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-align: center;
  text-transform: uppercase;
}

.attendance-table td {
  padding: 4px;
  text-align: center;
}

.attendance-table .attendance-index {
  left: 0;
  width: 46px;
  min-width: 46px;
  max-width: 46px;
}

.attendance-table .attendance-student {
  left: 46px;
  width: 240px;
  min-width: 240px;
  max-width: 240px;
  padding: 10px 12px;
  text-align: left;
}

.attendance-table .attendance-index,
.attendance-table .attendance-student {
  position: sticky;
  z-index: 3;
  background: var(--surface);
}

.attendance-table thead .attendance-index,
.attendance-table thead .attendance-student {
  z-index: 5;
  background: var(--surface-soft);
}

.attendance-table .attendance-student strong,
.attendance-table .attendance-student small {
  display: block;
}

.attendance-table .attendance-student small {
  margin-top: 2px;
  color: var(--muted);
}

.attendance-day {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
}

.attendance-day span,
.attendance-day small {
  display: block;
}

.attendance-day small {
  margin-top: 2px;
  font-size: 9px;
  letter-spacing: 0;
  text-transform: none;
}

.attendance-day.weekend,
.attendance-day-off.weekend {
  background: color-mix(in srgb, var(--muted) 10%, var(--surface-soft));
  color: var(--muted);
}

.attendance-day.holiday,
.attendance-day-off.holiday {
  background: color-mix(in srgb, var(--danger) 11%, var(--surface-soft));
  color: var(--danger);
}

.attendance-day-off span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 800;
}

.attendance-cell-input {
  width: 36px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.attendance-cell-input.mark-present {
  border-color: color-mix(in srgb, var(--success) 34%, transparent);
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}

.attendance-cell-input.mark-absent {
  border-color: color-mix(in srgb, var(--danger) 34%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.attendance-cell-input:hover,
.attendance-cell-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--accent-light);
}

.attendance-total {
  width: 74px;
  min-width: 74px;
  font-weight: 800;
}

.attendance-total.rate {
  color: var(--success);
}

.attendance-total.absent {
  color: var(--danger);
}

.attendance-year-plan-panel {
  overflow: hidden;
}

.attendance-year-plan-panel #attendanceYearPlanContainer {
  padding: 0;
  max-width: none;
}

.attendance-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.student-document-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.student-document-card {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  padding: 18px;
}

.student-document-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--accent-light);
  color: var(--accent);
  font-family: "Unbounded", sans-serif;
  font-size: 13px;
  font-weight: 800;
}

.student-document-card strong,
.student-document-card small {
  display: block;
}

.student-document-card strong {
  margin-bottom: 5px;
  font-size: 15px;
}

.student-document-card small {
  color: var(--muted);
  line-height: 1.45;
}

.records-data-table {
  min-width: 1050px;
}

.records-data-table th,
.records-data-table td {
  padding: 10px;
}

.records-data-table td {
  font-size: 12px;
  line-height: 1.45;
}

.records-data-table .records-row-number {
  width: 48px;
  color: var(--muted);
  text-align: center;
}

.records-inline-input,
.records-inline-textarea {
  width: 100%;
  min-width: 120px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 1.4;
}

.records-inline-input {
  height: 38px;
  padding: 7px 8px;
}

.records-inline-textarea {
  min-height: 62px;
  padding: 8px;
  resize: vertical;
}

.records-inline-input:hover,
.records-inline-input:focus,
.records-inline-textarea:hover,
.records-inline-textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--accent-light);
}

.birth-date-fields {
  display: grid;
  grid-template-columns: 42px 42px 68px;
  gap: 6px;
  min-width: 164px;
}

.birth-date-fields input {
  width: 100%;
  height: 38px;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: center;
}

.birth-date-fields input:last-child {
  padding-inline: 6px;
}

.birth-date-fields input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.prevention-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(210px, .55fr) minmax(190px, .45fr);
  gap: 10px;
  margin-bottom: 18px;
}

.records-filter-input,
.records-filter-select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
}

.records-filter-input:focus,
.records-filter-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.prevention-table {
  min-width: 1540px;
}

.prevention-table th:nth-child(1) { width: 190px; }
.prevention-table th:nth-child(2) { width: 190px; }
.prevention-table th:nth-child(3) { width: 230px; }
.prevention-table th:nth-child(4) { width: 90px; }
.prevention-table th:nth-child(5) { width: 210px; }
.prevention-table th:nth-child(6) { width: 160px; }
.prevention-table th:nth-child(7),
.prevention-table th:nth-child(8) { width: 112px; }
.prevention-table th:nth-child(9) { width: 230px; }
.prevention-table th:nth-child(10) { width: 90px; }

.prevention-tag,
.prevention-status {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.prevention-tag {
  background: var(--accent-light);
  color: var(--accent);
}

.prevention-status {
  background: var(--warning-light);
  color: var(--warning);
}

.prevention-status.status-improving {
  background: color-mix(in srgb, var(--success-light) 80%, var(--surface));
  color: var(--success);
}

.prevention-status.status-resolved {
  background: var(--success-light);
  color: var(--success);
}

.prevention-occurrences {
  color: var(--accent);
  font-family: "Unbounded", sans-serif;
  font-weight: 800;
  text-align: center;
}

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

.prevention-row-actions button,
.records-modal-close {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.prevention-row-actions button:hover,
.records-modal-close:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.records-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(26, 15, 19, .56);
}

.records-modal.hidden {
  display: none !important;
}

.records-modal-dialog {
  width: min(820px, 100%);
  max-height: min(90vh, 820px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-hover);
}

.records-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.records-modal-head h2 {
  margin: 0;
  font-family: "Unbounded", sans-serif;
  font-size: 21px;
}

.prevention-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.prevention-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.prevention-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.prevention-field input,
.prevention-field select,
.prevention-field textarea {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
}

.prevention-field textarea {
  resize: vertical;
}

.prevention-field input:focus,
.prevention-field select:focus,
.prevention-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.prevention-field-wide {
  grid-column: 1 / -1;
}

.prevention-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.social-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.social-summary-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.social-summary-card span,
.social-summary-card strong {
  display: block;
}

.social-summary-card span {
  min-height: 36px;
  color: var(--muted);
  font-size: 12px;
}

.social-summary-card strong {
  margin-top: 5px;
  color: var(--accent);
  font-family: "Unbounded", sans-serif;
  font-size: 20px;
}

.social-sections {
  display: grid;
  gap: 12px;
}

.social-section {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.social-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.social-section summary::-webkit-details-marker {
  display: none;
}

.social-section[open] summary {
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

.social-count {
  display: inline-flex;
  min-width: 34px;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12px;
}

.social-empty {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.records-save-status {
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1200px) {
  .attendance-months {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .records-metrics,
  .social-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .records-hero,
  .records-section-head {
    flex-direction: column;
  }

  .records-actions {
    width: 100%;
    justify-content: stretch;
  }

  .records-actions .btn {
    flex: 1 1 140px;
  }

  .attendance-months,
  .student-document-nav,
  .records-metrics,
  .social-summary-grid {
    grid-template-columns: 1fr;
  }

  .records-panel,
  .records-hero {
    padding: 16px;
    border-radius: 18px;
  }

  .student-document-card {
    grid-template-columns: 44px 1fr;
    padding: 15px;
  }

  .student-document-icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }

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

  .prevention-field-wide {
    grid-column: auto;
  }

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

  .records-modal-dialog {
    max-height: 92dvh;
    border-radius: 24px 24px 0 0;
    padding: 18px;
  }

  .prevention-form-actions .btn {
    flex: 1;
  }
}

@media print {
  .sidebar,
  .topbar,
  .student-document-nav,
  .records-actions,
  .records-note,
  .attendance-months {
    display: none !important;
  }

  .main,
  .content,
  .records-panel,
  .records-hero {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  .records-table-wrap {
    overflow: visible;
  }
}
