:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --ink: #102033;
  --muted: #5e6c7d;
  --line: #d8e1df;
  --navy: #102a43;
  --navy-soft: #243b53;
  --green: #1f8a4c;
  --green-soft: #36b267;
  --green-light: #eaf7ef;
  --gray: #697586;
  --gray-soft: #eef2f1;
  --red: #c9333a;
  --shadow: 0 12px 32px rgba(16, 42, 67, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
}

a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 68px;
  padding: 12px clamp(16px, 4vw, 44px);
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(16, 42, 67, .09);
  overflow: hidden;
}

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

.topnav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.topnav a,
.userbox a {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
}

.topnav a:hover,
.userbox a:hover { background: var(--gray-soft); color: var(--ink); }

.userbox {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.sede-chip {
  display: inline-flex;
  align-items: center;
  max-width: 260px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #b9dcc7;
  border-radius: 8px;
  background: var(--green-light);
  color: #165a36;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page {
  width: min(1160px, calc(100% - 28px));
  margin: 28px auto 80px;
}

.hero,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.hero {
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 4vw, 44px); line-height: 1.08; }
h2 { font-size: 22px; }
h3 { margin: 18px 0 10px; font-size: 18px; }
.eyebrow { margin-bottom: 8px; color: var(--green); font-weight: 800; text-transform: uppercase; font-size: 13px; }
.muted-text { color: var(--muted); line-height: 1.45; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.action-card {
  display: flex;
  flex-direction: column;
  min-height: 168px;
  padding: 22px;
  border: 1px solid var(--line);
  border-top: 6px solid var(--green);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.action-card:hover { transform: translateY(-2px); }
.action-card strong { margin-top: auto; font-size: 24px; }
.action-card small { margin-top: 8px; color: var(--muted); line-height: 1.35; }
.icon { font-size: 34px; font-weight: 800; }
.accent-blue { border-top-color: var(--navy); }
.accent-green { border-top-color: var(--green); }
.accent-orange { border-top-color: var(--green-soft); }
.accent-red { border-top-color: var(--navy-soft); }
.accent-purple { border-top-color: var(--gray); }
.accent-teal { border-top-color: var(--green); }
.accent-gray { border-top-color: var(--gray); }
.accent-dark { border-top-color: var(--navy); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}

.btn.primary { background: var(--navy); color: white; }
.btn.secondary { background: white; border-color: var(--line); color: var(--ink); }
.btn.small { min-height: 36px; padding: 7px 11px; background: var(--gray-soft); }
.btn.danger { background: var(--red); color: white; }
.field-note {
  align-self: end;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.35;
}

.toolbar,
.form-row {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-actions form {
  margin: 0;
}

.form-stack {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
}

textarea { resize: vertical; line-height: 1.45; }

.info-strip,
.suggestion {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-left: 5px solid var(--green);
  border-radius: 8px;
  background: var(--green-light);
  color: #165a36;
  font-weight: 700;
}

.student-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.student-list.compact {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.student-list.list-single {
  grid-template-columns: 1fr;
}

.student-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.student-check {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--ink);
}

.student-check span {
  min-width: 0;
}

.student-check strong {
  overflow-wrap: anywhere;
}

.student-row input { width: 22px; min-height: 22px; }
.student-row small { display: block; margin-top: 4px; color: var(--muted); }
.student-row.selected { border-color: var(--green); background: var(--green-light); }

.student-help {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--gray-soft);
  color: var(--navy);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.student-help:hover,
.student-help:focus-visible {
  border-color: var(--green);
  background: var(--green-light);
  outline: none;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 220px;
}
.row-actions form { margin: 0; }

.monitor-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.monitor-row small {
  display: block;
  margin: 4px 0 12px;
  color: var(--muted);
}

.group-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin: 18px 0 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.group-tab {
  min-width: 74px;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--gray-soft);
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.group-tab.active {
  background: white;
  color: var(--navy);
  box-shadow: 0 -4px 14px rgba(16, 42, 67, .06);
}

.group-panel {
  display: none;
  padding: 18px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: white;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.group-panel.active {
  display: block;
}

.group-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.group-panel-head h2 {
  margin: 0;
}

.group-panel-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.date-badge,
.date-alert {
  border: 1px solid #f1cf89;
  border-radius: 8px;
  background: #fff8e8;
  color: #755500;
  font-weight: 800;
}

.date-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
}

.date-badge.selected,
.date-alert.selected,
input.date-selected {
  border-color: var(--green);
  background: var(--green-light);
  color: #165a36;
  box-shadow: 0 0 0 3px rgba(31, 138, 76, .12);
}

.date-alert {
  margin: -8px 0 14px;
  padding: 10px 12px;
}

.view-toggle {
  align-self: center;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

.asis-modal {
  width: min(520px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(16, 42, 67, .24);
}

.asis-modal::backdrop {
  background: rgba(16, 42, 67, .36);
}

.modal-card {
  display: grid;
  gap: 16px;
  padding: 22px;
  background: white;
}

.modal-card h2 {
  margin: 0;
}

.modal-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

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

.voice-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.inline-check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
}

.inline-check input {
  width: 22px;
  min-height: 22px;
}

.quick-chips,
.report-type-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-chip {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--gray-soft);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.quick-chip.active {
  border-color: var(--navy);
  background: var(--navy);
  color: white;
}

.report-type-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.report-type-card {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--green);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  cursor: pointer;
}

.report-type-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.report-type-card span {
  font-size: 20px;
  font-weight: 800;
}

.report-type-card small {
  color: var(--muted);
}

.quick-range-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.quick-range-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  background: white;
}

.quick-range-card.active {
  border-color: var(--green);
  background: var(--green-light);
}

.quick-range-card small {
  color: var(--muted);
  line-height: 1.3;
}

.report-type-card:has(input:checked) {
  border-color: var(--green);
  background: var(--green-light);
  box-shadow: inset 0 0 0 2px rgba(31, 138, 76, .12);
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding: 14px 0 4px;
  background: linear-gradient(180deg, rgba(245,247,251,0), var(--bg) 28%);
}

.panel {
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.role-grid,
.context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.role-grid article,
.context-grid div {
  display: grid;
  gap: 6px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.role-grid strong,
.context-grid strong {
  color: var(--navy);
}

.role-grid span,
.context-grid span {
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.context-grid + .suggestion,
.context-grid + .muted-text {
  margin-top: 16px;
}

.compact-table {
  margin-top: 14px;
  box-shadow: none;
}

.compact-table table {
  min-width: 620px;
}

.pirds-sheet {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fdfefe;
  box-shadow: var(--shadow);
}

.pirds-word {
  --pirds-red: #9f0000;
  --pirds-red-dark: #8b0000;
  --pirds-paper: #ffffff;
  border-radius: 0;
  background: var(--pirds-paper);
  font-family: Georgia, "Times New Roman", serif;
}

.pirds-title {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 2px solid var(--navy);
  border-radius: 8px;
  background: white;
  text-align: center;
}

.pirds-word .pirds-title {
  border-color: var(--pirds-red-dark);
  border-radius: 2px;
}

.pirds-title h2 {
  margin: 0;
  font-size: 30px;
  color: var(--navy);
}

.pirds-title p {
  margin: 0;
  color: var(--muted);
}

.pirds-block {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #b9c7d3;
  border-radius: 8px;
  background: white;
}

.pirds-word .pirds-block {
  border-color: #d7d7d7;
  border-radius: 2px;
  box-shadow: none;
}

.pirds-block h2 {
  margin: -16px -16px 4px;
  padding: 10px 14px;
  border-radius: 8px 8px 0 0;
  background: #d9ead3;
  color: var(--navy);
  font-size: 18px;
  text-transform: uppercase;
}

.pirds-word .pirds-block h2,
.pirds-word .pirds-inner-title {
  justify-self: center;
  width: min(760px, 100%);
  margin: -16px auto 10px;
  border-radius: 0;
  background: var(--pirds-red-dark);
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  text-align: center;
}

.pirds-block h3 {
  margin: 4px 0 0;
  color: var(--navy);
  font-size: 16px;
}

.pirds-word .pirds-block h3 {
  display: inline-block;
  justify-self: start;
  padding: 4px 6px;
  background: var(--pirds-red);
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
}

.pirds-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.pirds-field-grid-word {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.pirds-field-grid div,
.pirds-field-grid label {
  display: grid;
  gap: 5px;
  min-height: 58px;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.pirds-word .pirds-field-grid label {
  min-height: 76px;
  background: #fff;
}

.pirds-field-grid strong,
.pirds-check-list strong {
  color: var(--navy);
}

.pirds-word .pirds-field-grid strong {
  color: #111;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.pirds-field-grid span,
.pirds-check-list span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.pirds-field-grid input {
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid #cfd9df;
  border-radius: 6px;
  background: #fff;
}

.pirds-field-grid input[readonly] {
  background: #f5f7f8;
  color: var(--muted);
}

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

.pirds-word .pirds-check-list {
  gap: 4px;
}

.pirds-check-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: start;
  gap: 8px;
  padding: 4px 0;
  color: #111;
}

.pirds-check-row input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
}

.pirds-check-row span {
  color: #111;
}

.pirds-check-list.two-cols {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.strategy-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
}

.strategy-check-grid label {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--ink);
}

.pirds-word .strategy-check-grid label,
.pirds-word .pirds-check-list div,
.pirds-word .pirds-empty-lines {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.strategy-check-grid input {
  width: 20px;
  min-height: 20px;
}

.pirds-check-list div,
.pirds-check-list.two-cols span,
.pirds-empty-lines {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  line-height: 1.55;
}

.signature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.signature-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.signature-card-inline {
  margin-top: 12px;
}

.signature-card h3 {
  margin: 0;
}

.signature-pad {
  display: block;
  width: 100%;
  height: 180px;
  min-height: 180px;
  border: 2px dashed var(--navy);
  border-radius: 8px;
  background: white;
  touch-action: none;
}

.signature-box {
  display: grid;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 10px;
  border: 2px solid #9fb3c8;
  border-radius: 8px;
  background: #eef6ff;
}

.signature-box span {
  color: var(--navy);
  font-weight: 800;
  text-align: center;
}

.signature-preview {
  width: 100%;
  max-height: 110px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.signature-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.pirds-block .pirds-inner-title {
  margin: 18px 0 4px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #d9ead3;
  color: var(--navy);
  font-size: 18px;
  text-transform: uppercase;
}

.multi-date-list {
  display: grid;
  gap: 8px;
}

.objective-eval-list {
  display: grid;
  gap: 12px;
}

.objective-eval-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.objective-eval-item p {
  margin: 0;
  color: var(--ink);
}

.objective-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.pirds-followup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.pirds-followup-grid div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.pirds-followup-grid span {
  color: var(--muted);
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.check-grid label {
  grid-template-columns: 22px 1fr;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.check-grid input { width: 20px; min-height: 20px; }
.check-grid small { display: block; margin-top: 4px; color: var(--muted); }

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

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

th { background: var(--gray-soft); color: var(--muted); font-size: 13px; text-transform: uppercase; }
td small { color: var(--muted); }
.status { display: inline-block; padding: 5px 9px; border-radius: 999px; background: var(--green-light); color: #165a36; font-weight: 800; }

.diag-list {
  display: grid;
  gap: 10px;
}

.diag-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.diag-list span {
  color: var(--muted);
  text-align: right;
  overflow-wrap: anywhere;
}

.diag-list .ok { color: var(--green); font-weight: 800; }
.diag-list .bad { color: var(--red); font-weight: 800; }

.messages { margin-bottom: 18px; }
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 10px; border: 1px solid var(--line); background: white; }
.alert-success { border-color: #9bd2b0; background: #edf9f1; }
.alert-warning { border-color: #f1cf89; background: #fff8e8; }
.alert-danger { border-color: #e8a3a7; background: #fff0f1; }
.alert-info { border-color: #a6c8ee; background: #eef6ff; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #f4f7f6 0%, #e7efec 100%);
}

.login-shell { width: min(440px, 100%); }
.login-panel {
  padding: 30px;
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.brand-login { margin-bottom: 24px; }
.login-panel h1 { font-size: 34px; margin-bottom: 10px; }
.login-panel p { color: var(--muted); line-height: 1.45; }

@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; gap: 10px; }
  .topnav { width: 100%; overflow-x: auto; }
  .userbox { width: 100%; justify-content: space-between; }
  .hero, .section-head { align-items: stretch; flex-direction: column; }
  .toolbar, .form-row { display: grid; grid-template-columns: 1fr; }
  .action-card { min-height: 148px; }
  .signature-grid { grid-template-columns: 1fr; }
  .signature-pad { height: 210px; min-height: 210px; }
  .signature-card-inline { width: 100%; padding: 10px; }
  .signature-card-inline .signature-box { display: grid; min-height: 280px; }
  .signature-card-inline .signature-pad { height: 220px; min-height: 220px; }
  .signature-card-inline + .btn,
  [data-signature-submit] { width: 100%; max-width: 100%; }
  .signature-actions { justify-content: stretch; }
  .signature-actions .btn { width: 100%; }
}
