/* School portal styles. One file, no build step, no third-party code. */

:root {
  --green-900: #0b3b2a;
  --green-800: #0d4b34;
  --green-700: #0e6b45;
  --green-50: #edf7f1;
  --gold: #c8a03a;
  --ink: #18211c;
  --muted: #5a6860;
  --line: #dde4df;
  --bg: #f4f6f4;
  --card: #ffffff;
  --red: #a8231c;
  --red-50: #fdeceb;
  --amber: #7a5200;
  --amber-50: #fff3d1;
  --blue: #1d4f91;
  --blue-50: #e8f0fb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 24, 0.06), 0 4px 14px rgba(16, 32, 24, 0.04);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  text-wrap: balance;
}

h1 {
  font: 600 1.75rem/1.2 var(--serif);
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.05rem;
  font-weight: 650;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
}

p {
  margin: 0 0 0.75rem;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--green-700);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--green-900);
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--card);
  padding: 0.5rem 1rem;
  z-index: 10;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.875rem;
}

.nowrap {
  white-space: nowrap;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- Layout ---------- */
.shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--green-900);
  color: #e6efe9;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.9rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: #fff;
  text-decoration: none;
  padding: 0.25rem 0.4rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 0.9rem;
}

.brand:hover {
  color: #fff;
}

.crest {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  font: 700 0.8rem var(--serif);
  letter-spacing: 0.04em;
  color: var(--gold);
}

.brand-name {
  font: 600 0.98rem/1.25 var(--serif);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav a {
  color: #d6e4dc;
  text-decoration: none;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-weight: 500;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav a[aria-current="page"] {
  background: var(--green-700);
  color: #fff;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.who {
  padding: 0 0.4rem 0.7rem;
  line-height: 1.35;
}

.who strong {
  display: block;
  color: #fff;
  overflow-wrap: anywhere;
}

.who span {
  font-size: 0.85rem;
  color: #a9c2b5;
}

.content {
  padding: 2rem clamp(1rem, 3vw, 2.5rem) 3rem;
  max-width: 1180px;
  width: 100%;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1.5rem;
}

.page-head .sub {
  color: var(--muted);
  margin: 0.3rem 0 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.eyebrow {
  display: block;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green-700);
  margin-bottom: 0.3rem;
}

.breadcrumb {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.grid {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
}

.cols-4 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.grid > .card {
  margin-bottom: 0;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.9rem;
}

.stat-value {
  font: 600 2rem/1.1 var(--serif);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.empty {
  color: var(--muted);
  padding: 0.5rem 0;
}

.items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.items > li {
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
}

.items > li:first-child {
  border-top: 0;
  padding-top: 0;
}

.items > li:last-child {
  padding-bottom: 0;
}

.item-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}

.item-title {
  font-weight: 600;
}

.prose {
  overflow-wrap: anywhere;
}

.prose p {
  margin-bottom: 0.6rem;
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  margin: 0 -1.25rem -1.25rem;
  padding: 0 1.25rem 1.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

thead th {
  border-top: 0;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

th:first-child,
td:first-child {
  padding-left: 0;
}

th:last-child,
td:last-child {
  padding-right: 0;
}

th.num,
td.num {
  text-align: right;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  background: #eceeed;
  color: #3d4842;
}

.badge-green {
  background: var(--green-50);
  color: var(--green-800);
}

.badge-amber {
  background: var(--amber-50);
  color: var(--amber);
}

.badge-red {
  background: var(--red-50);
  color: var(--red);
}

.badge-blue {
  background: var(--blue-50);
  color: var(--blue);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font: 600 0.95rem/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background: var(--green-700);
  color: #fff;
}

.btn-primary:hover {
  background: var(--green-800);
  color: #fff;
}

.btn-secondary {
  background: var(--card);
  border-color: #c3cec7;
  color: var(--ink);
}

.btn-secondary:hover {
  background: var(--green-50);
  color: var(--ink);
}

.btn-danger {
  background: var(--card);
  border-color: #e3b5b1;
  color: var(--red);
}

.btn-danger:hover {
  background: var(--red-50);
  color: var(--red);
}

.btn-ghost {
  width: 100%;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-small {
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
}

.btn-wide {
  width: 100%;
}

.inline {
  display: inline;
}

/* ---------- Forms ---------- */
.field {
  margin-bottom: 1.1rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.req {
  color: var(--red);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #b9c5bd;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
  min-height: 6rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(14, 107, 69, 0.3);
  outline-offset: 0;
  border-color: var(--green-700);
}

input[type="checkbox"],
input[type="radio"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--green-700);
  vertical-align: -0.15rem;
}

.help {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 0.3rem;
}

.help ul {
  margin: 0.2rem 0 0;
  padding-left: 1.2rem;
}

.error {
  color: var(--red);
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0.3rem 0 0;
}

.has-error input,
.has-error textarea,
.has-error select {
  border-color: var(--red);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.4rem;
}

.narrow {
  max-width: 640px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
}

.filters .field {
  margin: 0;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
}

.choices label {
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
}

/* ---------- Messages ---------- */
.messages {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.msg {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--blue-50);
  color: var(--blue);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.msg.success {
  background: var(--green-50);
  border-color: #bfdccb;
  color: var(--green-800);
}

.msg.error {
  background: var(--red-50);
  border-color: #efc4c0;
  color: var(--red);
}

.msg.warning {
  background: var(--amber-50);
  border-color: #ecd596;
  color: var(--amber);
}

.notice {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--amber-50);
  color: var(--amber);
  margin-bottom: 1.25rem;
}

/* ---------- Details list (profile) ---------- */
.details {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.6rem 1.5rem;
  margin: 0;
}

.details dt {
  color: var(--muted);
}

.details dd {
  margin: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* ---------- Signed-out pages ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background:
    linear-gradient(160deg, rgba(11, 59, 42, 0.96), rgba(14, 107, 69, 0.92)),
    var(--green-900);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 14px;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.auth-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-brand .crest {
  margin: 0 auto 0.75rem;
  width: 56px;
  height: 56px;
  font-size: 1rem;
  color: var(--green-700);
  border-color: var(--green-700);
}

.auth-brand h1 {
  font-size: 1.35rem;
}

.auth-brand p {
  color: var(--muted);
  margin-top: 0.3rem;
}

.auth-foot {
  text-align: center;
  margin-top: 1.1rem;
  font-size: 0.9rem;
}

/* ---------- Small screens ---------- */
@media (max-width: 860px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 0.75rem 1rem;
  }

  .brand {
    border-bottom: 0;
    margin-bottom: 0.25rem;
    padding-bottom: 0.5rem;
  }

  .nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }

  .nav a {
    white-space: nowrap;
  }

  .sidebar-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
  }

  .who {
    padding: 0;
  }

  .btn-ghost {
    width: auto;
  }

  .content {
    padding-top: 1.25rem;
  }

  .filters {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media print {
  .sidebar,
  .actions,
  .messages {
    display: none;
  }

  .shell {
    display: block;
  }

  .card {
    box-shadow: none;
  }
}
