:root {
  color-scheme: light;
  --ink: #102018;
  --muted: #63756c;
  --line: #d7e1dc;
  --paper: #ffffff;
  --wash: #f6f8f6;
  --green: #137f4f;
  --green-dark: #0d5f3d;
  --gold: #f3b33d;
  --red: #b42318;
  --shadow: 0 16px 44px rgba(16, 32, 24, 0.08);
  --soft-shadow: 0 8px 24px rgba(16, 32, 24, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(19, 127, 79, 0.1), transparent 34vw),
    linear-gradient(180deg, #fbfdfb 0%, var(--wash) 360px),
    var(--wash);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 35px rgba(16, 32, 24, 0.05);
  backdrop-filter: blur(16px);
}

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

.brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

nav {
  display: flex;
  gap: 8px;
}

nav a {
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

nav a:hover {
  background: #edf3ef;
  color: var(--ink);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 54px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 28px;
  align-items: stretch;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #eef7f1 72%, #fff7e6 100%);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 12px;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1;
}

.lede {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.lookup {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 236px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.lookup label {
  margin-bottom: 10px;
  font-weight: 800;
}

.lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 10px;
}

input,
button,
select {
  height: 46px;
  border-radius: 8px;
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  padding: 0 13px;
  outline: none;
  background: rgba(255, 255, 255, 0.92);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(19, 127, 79, 0.14);
}

textarea {
  min-height: 132px;
  padding: 12px 13px;
  border-radius: 8px;
  font: inherit;
  resize: vertical;
}

button {
  border: 0;
  background: var(--green);
  color: white;
  font-weight: 900;
  cursor: pointer;
}

button:hover {
  background: var(--green-dark);
}

.result {
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  font-size: 14px;
}

.result.success {
  border: 1px solid rgba(19, 127, 79, 0.28);
  background: #eef8f2;
}

.result.error {
  border: 1px solid rgba(180, 35, 24, 0.24);
  background: #fff1ef;
  color: var(--red);
  font-weight: 700;
}

.result-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.result strong {
  display: block;
  font-size: 30px;
}

.result p {
  margin: 6px 0 0;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.stats article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.stats article {
  padding: 18px;
  box-shadow: var(--soft-shadow);
}

.stats span,
.metric-list span {
  color: var(--muted);
}

.stats strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
}

.stats small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.staff-chart-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.graph-toggle {
  margin-bottom: 18px;
}

.graph-toggle summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--green-dark);
  font-weight: 900;
  cursor: pointer;
  user-select: none;
}

.graph-toggle summary:hover {
  background: #eef8f2;
}

.graph-toggle[open] summary {
  margin-bottom: 14px;
  background: var(--green);
  color: #fff;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 11px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.chart-panel {
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfb 100%);
  box-shadow: var(--soft-shadow);
}

.chart-panel h2 {
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(105px, 0.72fr) minmax(120px, 1fr);
  gap: 10px;
  align-items: center;
}

.bar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
}

.bar-label span {
  color: var(--muted);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-label strong {
  display: inline-grid;
  min-width: 28px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: #fff3d4;
  color: #7a4c00;
  font-size: 12px;
}

.bar-track {
  height: 18px;
  overflow: hidden;
  border: 1px solid #dbe4df;
  border-radius: 6px;
  background: repeating-linear-gradient(90deg, #eef3ef 0, #eef3ef 1px, #f8fbf9 1px, #f8fbf9 24px);
}

.bar-track span {
  display: block;
  height: 100%;
  min-width: 6px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--green-dark), var(--green) 58%, var(--gold));
  box-shadow: inset 0 -1px 0 rgba(23, 33, 27, 0.16);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 20px;
  box-shadow: var(--soft-shadow);
}

.panel.wide {
  grid-row: span 2;
}

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

.panel h2 {
  margin-bottom: 14px;
  font-size: 20px;
}

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

.panel-head a {
  color: var(--green);
  font-weight: 800;
}

.table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

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

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

th {
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.metric-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.metric-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.metric-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.metric-list strong {
  display: inline-grid;
  min-width: 34px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: #fff3d4;
  color: #7a4c00;
}

.staff-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.staff-app-page {
  background:
    radial-gradient(circle at 12% 0%, rgba(243, 179, 61, 0.16), transparent 28vw),
    radial-gradient(circle at 88% 0%, rgba(19, 127, 79, 0.13), transparent 30vw),
    linear-gradient(180deg, rgba(238, 248, 242, 0.84), rgba(244, 247, 245, 0) 320px),
    var(--wash);
}

.staff-app-topbar {
  box-shadow: 0 10px 34px rgba(23, 33, 27, 0.05);
}

.nav-link,
.install-app-button,
.logout-form button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.nav-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.install-app-button {
  display: none;
  width: auto;
  height: auto;
  min-height: 36px;
  padding: 9px 12px;
  border-radius: 8px;
  background: #eef8f2;
  color: var(--green-dark);
  font-size: 14px;
}

.install-app-button.is-ready {
  display: inline-flex;
}

.staff-command {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(238, 248, 242, 0.95) 70%, rgba(255, 247, 230, 0.96) 100%);
  box-shadow: var(--shadow);
}

.mobile-bottom-nav {
  display: none;
}

.staff-hero h1 {
  max-width: 760px;
  margin-bottom: 10px;
  font-size: clamp(32px, 4vw, 50px);
}

.primary-action,
.secondary-action,
.form-actions a,
.text-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-action {
  flex: 0 0 auto;
  padding: 0 16px;
  box-shadow: 0 8px 22px rgba(19, 127, 79, 0.22);
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #fff;
}

.secondary-action {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--green-dark);
}

.secondary-action:hover {
  background: #eef8f2;
}

.secondary-action.compact {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.hero-actions,
.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.staff-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
}

.api-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.ai-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.suggestion-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.suggestion-card h2,
.suggestion-card p {
  margin-bottom: 0;
}

.suggestion-card p {
  color: var(--muted);
  line-height: 1.5;
}

.suggestion-card code {
  display: block;
  overflow-wrap: anywhere;
  margin-top: auto;
  padding: 10px;
  border-radius: 8px;
  background: #f4f7f5;
  color: var(--green-dark);
}

.suggestion-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.suggestion-meta span,
.suggestion-meta strong {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.suggestion-meta span {
  background: #eef8f2;
  color: var(--green-dark);
}

.suggestion-meta strong {
  background: #fff3d4;
  color: #7a4c00;
}

.wide-api {
  grid-column: 1 / -1;
}

.muted-text {
  color: var(--muted);
  line-height: 1.55;
}

pre {
  overflow-x: auto;
  margin: 14px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #17211b;
  color: #f8fbf9;
  white-space: pre-wrap;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.endpoint-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.endpoint-list li {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.endpoint-list span {
  color: var(--muted);
  font-weight: 800;
}

.endpoint-list code {
  overflow-wrap: anywhere;
}

.staff-table-panel {
  min-width: 0;
}

.staff-table-panel table {
  table-layout: fixed;
}

.staff-table-panel th:nth-child(1),
.staff-table-panel td:nth-child(1) {
  width: 64px;
}

.staff-table-panel th:nth-child(2),
.staff-table-panel td:nth-child(2) {
  width: 102px;
}

.staff-table-panel th:nth-child(3),
.staff-table-panel td:nth-child(3) {
  width: 168px;
}

.staff-table-panel th:nth-child(4),
.staff-table-panel td:nth-child(4),
.staff-table-panel th:nth-child(6),
.staff-table-panel td:nth-child(6),
.staff-table-panel th:nth-child(7),
.staff-table-panel td:nth-child(7),
.staff-table-panel th:nth-child(8),
.staff-table-panel td:nth-child(8) {
  width: 112px;
}

.staff-table-panel th:nth-child(5),
.staff-table-panel td:nth-child(5) {
  width: 70px;
}

.staff-table-panel th:nth-child(9),
.staff-table-panel td:nth-child(9) {
  width: 108px;
}

.staff-table-panel th:nth-child(10),
.staff-table-panel td:nth-child(10) {
  width: 170px;
}

.staff-table-panel th:nth-child(11),
.staff-table-panel td:nth-child(11) {
  width: 118px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px 190px 110px;
  gap: 10px;
  margin-bottom: 16px;
}

.empty-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: #eef8f2;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
}

.actions {
  display: flex;
  gap: 8px;
}

.actions a {
  padding: 7px 10px;
  border-radius: 8px;
  background: #eef3ef;
  color: var(--green-dark);
  font-weight: 800;
}

.actions .danger-link {
  background: #fff1ef;
  color: var(--red);
}

.student-avatar {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  object-fit: cover;
  background: #eef8f2;
  color: var(--green-dark);
  font-weight: 900;
}

.logout-form {
  margin: 0;
}

.logout-form button {
  height: auto;
  min-height: 36px;
  padding: 9px 12px;
  background: #edf3ef;
  color: var(--muted);
  font-size: 14px;
}

.messages {
  margin-bottom: 14px;
}

.staff-message-panel {
  margin-bottom: 18px;
  padding: 18px;
}

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

.staff-message-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f8fbf9);
  box-shadow: 0 8px 20px rgba(16, 32, 24, 0.04);
}

.staff-message-card h3 {
  margin: 4px 0;
  font-size: 18px;
}

.staff-message-card p {
  margin-bottom: 0;
  line-height: 1.5;
}

.message-date,
.message-sender {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.message-actions {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #eef7f1 0%, #ffffff 58%, #fff6df 100%);
}

.auth-shell {
  display: grid;
  width: min(100% - 32px, 460px);
  min-height: 100vh;
  place-items: center;
  padding: 28px 0;
}

.auth-card {
  width: 100%;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(23, 33, 27, 0.08);
}

.auth-card img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-bottom: 12px;
}

.auth-card h1 {
  margin-bottom: 8px;
  font-size: 34px;
}

.auth-card p {
  color: var(--muted);
  line-height: 1.5;
}

.auth-card label,
.record-form label {
  display: block;
  margin: 14px 0 7px;
  font-weight: 800;
}

.auth-card button {
  width: 100%;
  margin-top: 18px;
}

.text-link {
  margin-top: 10px;
  color: var(--green-dark);
}

.form-page {
  width: min(820px, calc(100% - 32px));
}

.form-panel h1 {
  margin-bottom: 8px;
  font-size: clamp(32px, 4vw, 46px);
}

.record-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 16px;
  margin-top: 18px;
}

.record-form .field:first-child,
.photo-preview,
.photo-field {
  grid-column: 1 / -1;
}

.photo-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.photo-preview img {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  object-fit: cover;
}

.photo-preview strong,
.photo-preview span {
  display: block;
}

.photo-preview span,
.field-help {
  color: var(--muted);
  font-size: 13px;
}

input[type="file"] {
  height: auto;
  padding: 12px;
  cursor: pointer;
}

input[type="checkbox"] {
  width: 22px;
  height: 22px;
  padding: 0;
  accent-color: var(--green);
}

.field-help {
  margin: 7px 0 0;
  line-height: 1.45;
}

.camera-box {
  display: grid;
  gap: 12px;
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.camera-box video {
  width: 100%;
  min-height: 220px;
  max-height: 380px;
  border-radius: 8px;
  background: #17211b;
  object-fit: cover;
}

.camera-actions,
.import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.camera-actions button {
  width: auto;
  min-width: 140px;
  padding: 0 14px;
}

.import-columns {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.import-errors {
  margin-top: 16px;
  background: #fff1ef;
}

.import-errors ul {
  margin: 0;
  padding-left: 20px;
  color: var(--red);
}

.field small {
  display: block;
  margin-top: 6px;
  color: var(--red);
  font-weight: 700;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  grid-column: 1 / -1;
  margin-top: 16px;
}

.form-actions button {
  width: 180px;
}

.form-actions a {
  padding: 0 14px;
  background: #edf3ef;
  color: var(--green-dark);
}

.danger-card {
  text-align: center;
}

.danger-button {
  background: var(--red);
}

.danger-button:hover {
  background: #8f1d14;
}

.story-body {
  background: #f3ece1;
}

.student-story-page {
  width: min(1120px, calc(100% - 32px));
}

.student-story-hero {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: clamp(22px, 4vw, 48px);
  align-items: stretch;
  min-height: calc(100vh - 160px);
  padding: clamp(18px, 4vw, 34px);
  border: 1px solid #d8cfc2;
  border-radius: 8px;
  background: #fbf6ee;
  box-shadow: 0 14px 38px rgba(42, 33, 24, 0.08);
}

.student-story-photo {
  display: grid;
  min-height: 420px;
  overflow: hidden;
  place-items: center;
  border-radius: 8px;
  background: #e6ded2;
}

.student-story-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.student-story-photo span {
  color: #6b5a49;
  font-size: 82px;
  font-weight: 900;
}

.student-story-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.student-story-content h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 6vw, 72px);
}

.student-story-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.student-story-meta article {
  padding: 14px;
  border: 1px solid #d8cfc2;
  border-radius: 8px;
  background: #fffaf3;
}

.student-story-meta span,
.sponsor-state {
  display: block;
  color: #7a6b5d;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.student-story-meta strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.student-public-story {
  max-width: 700px;
  color: #4f4338;
  font-size: 18px;
  line-height: 1.7;
}

.student-public-story p:last-child {
  margin-bottom: 0;
}

.student-story-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.student-share-panel {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid #d8cfc2;
}

.student-share-panel h2 {
  margin-bottom: 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
}

.share-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.share-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.share-whatsapp {
  background: #128c7e;
}

.share-facebook {
  background: #1877f2;
}

.share-x {
  background: #111111;
}

.share-linkedin {
  background: #0a66c2;
}

.student-message-panel {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid #d8cfc2;
}

.student-message-panel h2 {
  margin-bottom: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
}

.student-message-panel p {
  max-width: 640px;
  color: #7a6b5d;
  line-height: 1.55;
}

.student-message-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  margin-top: 16px;
}

.student-message-form .field:nth-child(3),
.student-message-form button {
  grid-column: 1 / -1;
}

.student-message-form label {
  display: block;
  margin-bottom: 7px;
  font-weight: 800;
}

.student-message-form button {
  width: 180px;
}

.sponsor-state {
  width: fit-content;
  padding: 9px 12px;
  border-radius: 999px;
  background: #fff3d4;
  color: #7a4c00;
}

.sponsor-state.sponsored {
  background: #eef8f2;
  color: var(--green-dark);
}

@media (max-width: 1120px) {
  .content-grid,
  .staff-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel.wide {
    grid-row: auto;
  }

  .staff-layout > aside {
    order: 2;
  }

  .staff-table-panel {
    order: 1;
  }

  .table-wrap {
    max-width: 100%;
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
    max-width: 100%;
    min-width: 0 !important;
  }

  table {
    table-layout: auto;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tr {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(23, 33, 27, 0.06);
  }

  td {
    display: grid;
    grid-template-columns: minmax(90px, 28%) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    width: 100% !important;
    min-height: 34px;
    padding: 7px 0;
    border-bottom: 1px solid #eef3ef;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  td:last-child {
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
  }

  td[data-label="Photo"] {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  td[data-label="Photo"]::before {
    content: "";
  }

  td.actions {
    display: grid;
    grid-template-columns: minmax(90px, 28%) minmax(0, 1fr);
    align-items: center;
  }

  td.actions a {
    display: inline-flex;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    margin: 3px 6px 3px 0;
  }
}

@media (max-width: 860px) {
  .staff-app-page {
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
    background: #eef3ef;
  }

  .staff-app-main {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  .hero,
  .student-story-hero,
  .content-grid,
  .chart-grid,
  .stats,
  .staff-layout,
  .ai-grid,
  .api-grid,
  .filters {
    grid-template-columns: 1fr;
  }

  .wide-api {
    grid-column: auto;
  }

  .endpoint-list li {
    grid-template-columns: 1fr;
  }

  .staff-message-card {
    grid-template-columns: 1fr;
  }

  .message-actions {
    justify-content: flex-start;
  }

  .staff-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .hero-actions a {
    flex: 1 1 160px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .staff-app-topbar {
    position: sticky;
    align-items: center;
    flex-direction: row;
    min-height: 64px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(219, 228, 223, 0.86);
    box-shadow: 0 12px 34px rgba(23, 33, 27, 0.08);
  }

  .staff-app-topbar .brand img {
    width: 40px;
    height: 40px;
  }

  .desktop-nav {
    display: none;
  }

  .mobile-bottom-nav {
    position: fixed;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 10px;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(219, 228, 223, 0.95);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 50px rgba(23, 33, 27, 0.2);
    backdrop-filter: blur(12px);
  }

  .mobile-bottom-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    min-height: 44px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
  }

  .mobile-bottom-nav .nav-icon {
    width: 19px;
    height: 19px;
  }

  .mobile-bottom-nav a.active,
  .mobile-bottom-nav a:hover {
    background: #eef8f2;
    color: var(--green-dark);
  }

  .staff-command {
    gap: 18px;
    padding: 20px;
  }

  .staff-command h1 {
    font-size: 31px;
  }

  .staff-command .lede {
    font-size: 15px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stats article {
    min-height: 112px;
    padding: 14px;
  }

  .stats strong {
    font-size: 31px;
  }

  .staff-message-panel,
  .chart-panel,
  .staff-table-panel,
  .staff-layout > .panel {
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(23, 33, 27, 0.06);
  }

  .staff-layout > aside {
    order: 2;
  }

  .staff-table-panel {
    order: 1;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-actions {
    justify-content: flex-start;
  }

  .filters {
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbf9;
  }

  .table-wrap {
    max-width: 100%;
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 12px;
    min-width: 0;
  }

  tr {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(23, 33, 27, 0.06);
  }

  td {
    display: grid;
    grid-template-columns: minmax(76px, 31%) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    width: 100% !important;
    min-height: 34px;
    padding: 7px 0;
    border-bottom: 1px solid #eef3ef;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  td:last-child {
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
  }

  td[data-label="Photo"] {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  td[data-label="Photo"]::before {
    content: "";
  }

  td.actions {
    display: grid;
    grid-template-columns: minmax(76px, 31%) minmax(0, 1fr);
    align-items: center;
  }

  td.actions a {
    display: inline-flex;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    margin: 3px 6px 3px 0;
  }

  td.actions::before {
    align-self: center;
  }
}

@media (max-width: 520px) {
  main {
    width: min(100% - 16px, 1180px);
    padding-top: 18px;
  }

  .staff-app-main {
    width: min(100% - 14px, 1180px);
  }

  .hero {
    padding: 20px;
  }

  .panel,
  .staff-message-panel {
    padding-right: 12px;
    padding-left: 12px;
  }

  .panel-head {
    gap: 10px;
  }

  .panel-head h2 {
    overflow-wrap: anywhere;
  }

  td {
    grid-template-columns: minmax(70px, 34%) minmax(0, 1fr);
    font-size: 13px;
  }

  td.actions {
    grid-template-columns: minmax(70px, 34%) minmax(0, 1fr);
  }

  .lookup-row {
    grid-template-columns: 1fr;
  }

  button,
  .form-actions button {
    width: 100%;
  }

  .camera-actions button {
    width: 100%;
  }

  .record-form {
    grid-template-columns: 1fr;
  }

  .student-story-meta {
    grid-template-columns: 1fr;
  }

  .student-message-form {
    grid-template-columns: 1fr;
  }

  .student-story-photo {
    min-height: 320px;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
