:root {
  font-family: system-ui, sans-serif;
  color: #172333;
  background: #f7f9fc;
  line-height: 1.45;
  letter-spacing: 0;
}
* { box-sizing: border-box; }
body { margin: 0; }
.scan-modal[hidden] { display: none; }
.scan-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: #0f172acc; }
.scan-panel { width: min(520px, 100%); padding: 16px; border-radius: 8px; background: #fff; }
.scan-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.scan-heading h2 { margin: 0; font-size: 20px; }
.scan-camera { width: 100%; aspect-ratio: 4 / 3; margin: 14px 0; overflow: hidden; border-radius: 6px; background: #172333; }
.scan-camera video { width: 100%; height: 100%; object-fit: cover; }
#family-scan-status { min-height: 24px; margin: 0 0 12px; color: #35465b; }
button, input { font: inherit; }
button {
  cursor: pointer;
  min-height: 42px;
  border: 1px solid #cbd6e3;
  border-radius: 6px;
  background: #fff;
  color: #176ac0;
  padding: 9px 16px;
}
button:disabled { opacity: .55; cursor: wait; }
button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid #176ac0;
  outline-offset: 2px;
}
.site-header {
  background: #fff;
  border-bottom: 1px solid #dce5ef;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px max(16px, calc((100% - 1100px) / 2));
}
.site-header strong { font-size: 18px; }
.site-header a { color: #176ac0; text-decoration: none; font-weight: 600; }
.site-header a:hover { text-decoration: underline; }
main { max-width: 1100px; margin: auto; padding: 24px 16px 60px; }
.search-section { padding: 8px 0 24px; border-bottom: 1px solid #dce5ef; }
.search-section h1 { font-size: 26px; line-height: 1.2; margin: 0 0 20px; }
.search-fields {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.search-fields label, .name-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  font-size: 13px;
  font-weight: 650;
  color: #35465b;
}
.name-field { position: relative; }
.search-fields input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cbd6e3;
  border-radius: 6px;
  background: #fff;
  padding: 10px 12px;
  color: #172333;
}
.name-suggestions {
  position: absolute;
  z-index: 5;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #cbd6e3;
  border-radius: 6px;
  box-shadow: 0 8px 18px #1723331c;
  max-height: 240px;
  overflow: auto;
}
.name-suggestions button {
  display: block;
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 0;
  text-align: left;
  color: #172333;
}
.name-suggestions button:hover, .name-suggestions button:focus-visible { background: #eaf3ff; }
.name-suggestions small { display: block; color: #65778a; }
.search-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}
.search-actions span { font-size: 13px; color: #26624e; }
.search-actions button {
  background: #176ac0;
  color: #fff;
  border-color: #176ac0;
  font-weight: 700;
  min-width: 112px;
}
#family-status { min-height: 22px; margin: 12px 0 0; font-size: 14px; color: #26624e; }
.status-error { color: #a52c36 !important; }
.identity { padding: 20px 0 12px; }
.identity p { margin: 0; color: #587087; font-size: 14px; }
.identity h2 { margin: 3px 0; font-size: clamp(22px, 2rem, 28px); line-height: 1.2; }
.subjects-section > h2, .general-notices > h2 { font-size: 19px; margin: 24px 0 14px; }
.subject-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr)); gap: 18px; align-items: start; }
.subject-card { min-width: 0; background: #fff; border: 1px solid #dce5ef; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 10px #1723330a; }
.subject-card h3 { margin: 0; padding: 18px 20px 14px; font-size: 19px; line-height: 1.25; overflow-wrap: anywhere; }
.subject-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-bottom: 1px solid #dce5ef; }
.subject-tab { display: flex; justify-content: center; align-items: center; gap: 7px; min-width: 0; min-height: 46px; padding: 8px 6px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; color: #52677d; font-size: 13px; font-weight: 650; white-space: nowrap; }
.subject-tab:hover { background: #f0f6fd; }
.subject-tab[aria-selected="true"] { color: #1169bf; border-bottom-color: #1673cc; background: #f2f8ff; }
.subject-tab small { display: inline-flex; justify-content: center; align-items: center; flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 50%; background: #eaf0f7; color: #3b526b; font-size: 11px; }
.subject-panel { padding: 18px 20px 20px; }
.calendar-toolbar { display: grid; grid-template-columns: 38px minmax(0, 1fr) 38px; align-items: center; gap: 8px; margin-bottom: 14px; }
.calendar-arrow { display: grid; place-items: center; min-width: 38px; min-height: 38px; padding: 0; font-size: 27px; line-height: 1; color: #176ac0; }
.calendar-month { margin: 0; text-align: center; font-size: 17px; line-height: 1.2; }
.attendance-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin-bottom: 18px; }
.summary-item { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; padding: 8px 2px; border-radius: 6px; text-align: center; font-size: 11px; }
.summary-item strong { font-size: 19px; line-height: 1.1; }
.summary-item.present { background: #e9f7f0; color: #087449; }
.summary-item.absent { background: #fff0f1; color: #b42332; }
.summary-item.late { background: #fff6df; color: #8b5a00; }
.summary-item.excused { background: #ebf5ff; color: #1762a8; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.calendar-weekdays { margin-bottom: 5px; text-align: center; color: #5a6f85; font-size: 11px; font-weight: 750; }
.calendar-weekdays span { padding: 4px 0; }
.calendar-weekdays .weekend { color: #a3afbc; }
.calendar-day { display: flex; flex-direction: column; justify-content: space-between; align-items: center; min-width: 0; height: 52px; padding: 4px 1px; border: 1px solid transparent; border-radius: 6px; font-size: 12px; line-height: 1.1; }
.calendar-no-class { background: #f5f7fa; color: #9aa9b8; }
.calendar-no-class.weekend { background: #fff; color: #bac5d0; }
.calendar-mark { cursor: pointer; }
.calendar-mark:hover { filter: brightness(.96); }
.calendar-mark[aria-pressed="true"] { outline: 2px solid #172333; outline-offset: 1px; }
.calendar-mark.present, .legend-mark.present { background: #dff4e8; color: #086e45; border-color: #a8dbc1; }
.calendar-mark.absent, .legend-mark.absent { background: #ffe6e8; color: #ad2030; border-color: #f4adb6; }
.calendar-mark.late, .legend-mark.late { background: #fff1ce; color: #8b5700; border-color: #edcf75; }
.calendar-mark.excused, .legend-mark.excused { background: #e2f1ff; color: #1465a8; border-color: #a9d2f3; }
.calendar-mark.unmarked { background: #eef1f5; color: #66788b; border-color: #dbe3eb; }
.day-number { align-self: flex-start; padding-left: 4px; font-weight: 650; }
.day-status { font-size: 20px; line-height: 1; }
.calendar-selection { min-height: 34px; margin: 14px 0 8px; padding: 8px 10px; border-left: 3px solid #176ac0; background: #f4f8fc; color: #34495e; font-size: 13px; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 7px 13px; color: #52677d; font-size: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-mark { display: inline-flex; justify-content: center; align-items: center; width: 20px; height: 20px; border: 1px solid; border-radius: 4px; font-size: 11px; }
.grade-unit + .grade-unit { margin-top: 18px; }
.grade-unit-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 5px 12px; padding-bottom: 8px; border-bottom: 1px solid #e5ecf3; }
.grade-unit-heading h4 { margin: 0; font-size: 15px; }
.grade-unit-heading span { color: #60748a; font-size: 12px; }
.grade-bucket { --bucket-color: #0f766e; --bucket-bg: #e9f7f4; margin-top: 12px; padding-left: 12px; border-left: 3px solid var(--bucket-color); }
.grade-bucket.discipline { --bucket-color: #ad3d56; --bucket-bg: #fceef1; }
.grade-bucket.exams { --bucket-color: #956012; --bucket-bg: #fff3dd; }
.grade-bucket-title { display: inline-block; margin: 0 0 2px -12px; padding: 4px 12px; background: var(--bucket-bg); color: var(--bucket-color); font-size: 12px; font-weight: 750; line-height: 1.3; }
.grade-bucket .grade-row:last-child { border-bottom: 0; }
.grade-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 11px 0; border-bottom: 1px solid #eef2f6; font-size: 14px; }
.grade-name { min-width: 0; overflow-wrap: anywhere; }
.grade-detail { grid-column: 1 / -1; color: #60748a; font-size: 12px; }
.grade-score { white-space: nowrap; }
.grade-score.passed, .grade-score.extra { color: #087449; }
.grade-score.failed { color: #b42332; }
.grade-score.ungraded { color: #66788b; }
.grade-track { grid-column: 1 / -1; display: block; height: 5px; overflow: hidden; border-radius: 4px; background: #e9edf2; }
.grade-fill { display: block; height: 100%; border-radius: inherit; }
.grade-fill.passed { background: #13976a; }
.grade-fill.failed { background: #dc4c59; }
.notices-view { border-left: 2px solid #dce5ef; margin-left: 5px; }
.notice-row { position: relative; padding: 0 0 18px 18px; }
.notice-row:last-child { padding-bottom: 0; }
.notice-row::before { position: absolute; content: ''; width: 10px; height: 10px; top: 5px; left: -6px; border-radius: 50%; background: #1778c7; border: 2px solid #fff; }
.notice-row time { display: block; color: #60748a; font-size: 12px; font-weight: 650; }
.notice-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 9px; }
.notice-kind, .incident-severity { display: inline-flex; align-items: center; min-height: 20px; padding: 1px 7px; border-radius: 4px; background: #e9f2fb; color: #145b99; font-size: 11px; font-weight: 700; }
.discipline-incident::before { background: #c24157; }
.incident-title { margin: 6px 0 0; font-size: 14px; line-height: 1.3; }
.incident-severity { background: #fcebef; color: #a52843; }
.incident-severity.baja { background: #fff2df; color: #885300; }
.incident-severity.media { background: #fff0e8; color: #a04414; }
.incident-severity.critica { background: #f5e9ef; color: #8b2149; }
.incident-impact { display: block; margin-top: 7px; color: #9a3049; font-size: 12px; font-weight: 650; }
.notice-row p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.empty { color: #65778a; font-size: 14px; padding: 14px 0; margin: 0; }
.general-notices { margin-top: 24px; padding-top: 4px; border-top: 1px solid #dce5ef; }
.general-notices #family-general-list { border-left: 2px solid #dce5ef; margin-left: 5px; }
[hidden] { display: none !important; }
@media (max-width: 750px) {
  .search-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-fields .name-field { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  main { padding: 18px 14px 48px; }
  .search-fields { grid-template-columns: 1fr; }
  .search-fields .name-field { grid-column: auto; }
  .search-actions { justify-content: space-between; }
  .search-section h1 { font-size: 22px; }
  .subject-panel { padding: 15px 12px 18px; }
  .subject-card h3 { padding: 16px 14px 12px; font-size: 17px; }
  .subject-tab { gap: 0; padding: 7px 2px; font-size: 11px; }
  .subject-tab small { display: none; }
  .calendar-weekdays, .calendar-grid { gap: 3px; }
  .calendar-day { height: 48px; }
}
