:root {
  --ink: #1c211c;
  --muted: #5c655c;
  --paper: #f6f1e8;
  --panel: #fffdf8;
  --line: #d8cfc0;
  --teal: #1f6b5a;
  --teal-deep: #13483c;
  --clay: #c45c2a;
  --warn-bg: #fff4e5;
  --ok-bg: #e8f4ee;
  --info-bg: #eef3f1;
  --shadow: 0 12px 32px rgba(28, 33, 28, 0.06);
  --sans: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --ui: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
}

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.rail {
  background: var(--teal-deep);
  color: #f4efe6;
  padding: 1.5rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.55rem;
  background: #f0c14b;
  color: var(--teal-deep);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.brand-text strong { display: block; font-size: 0.92rem; }
.brand-text small { color: #d6cbb8; }

.nav { display: flex; flex-direction: column; gap: 1rem; }

.nav-group { display: flex; flex-direction: column; gap: 0.2rem; }

.nav-group-label {
  margin: 0 0.7rem 0.2rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d6cbb8;
}

.nav-link {
  color: #f4efe6;
  text-decoration: none;
  padding: 0.45rem 0.7rem;
  border-radius: 0.45rem;
}

.nav-link[aria-current="page"],
.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

.rail-note {
  margin-top: auto;
  font-size: 0.8rem;
  color: #d6cbb8;
  line-height: 1.4;
}

.main {
  padding: 2rem 2.25rem 3rem;
  max-width: 1040px;
}

.page-head h1 {
  font-family: var(--sans);
  font-size: 2rem;
  margin: 0.15rem 0 0.5rem;
}

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--teal);
  margin: 0;
}

.lead { color: var(--muted); margin-top: 0; }

.banner {
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.9rem 1rem;
  margin: 1rem 0 1.25rem;
  box-shadow: var(--shadow);
}

.banner p { margin: 0.35rem 0 0; color: var(--muted); }
.banner-info { background: var(--info-bg); }
.banner-warn { background: var(--warn-bg); }
.banner-ok { background: var(--ok-bg); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  padding: 1.15rem 1.2rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.card h2 {
  font-family: var(--sans);
  font-size: 1.2rem;
  margin: 0 0 0.6rem;
}

.field { margin: 0.65rem 0; }

.field-label {
  display: block;
  font-size: 0.82rem;
  margin: 0 0 0.25rem;
}

.field-hint {
  margin: 0.3rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

input, select, button, .btn, .field-input {
  font: inherit;
}

.field-input,
input, select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: #fff;
}

.field-input-compact {
  width: auto;
  min-width: 7.5rem;
}

.row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  align-items: center;
}

button, .btn {
  appearance: none;
  border: 0;
  border-radius: 0.45rem;
  padding: 0.55rem 0.9rem;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary,
button.secondary, .btn.secondary {
  background: transparent;
  color: var(--teal-deep);
  border: 1px solid var(--line);
}

.btn-danger {
  background: var(--clay);
  color: #fff;
}

.btn-compact {
  padding: 0.28rem 0.55rem;
  font-size: 0.8rem;
}

button:disabled, .btn[aria-disabled="true"], .btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.table-wrap { overflow-x: auto; }

.table-toolbar { margin-bottom: 0.75rem; }

.filter-form {
  display: grid;
  grid-template-columns: 1fr 12rem auto;
  gap: 0.75rem;
  align-items: end;
}

.filter-form .row { margin-top: 0; }

.table-caption {
  caption-side: top;
  text-align: left;
  color: var(--muted);
  padding-bottom: 0.4rem;
}

.data-table,
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.data-table th,
.data-table td,
th, td {
  text-align: left;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table-empty td { color: var(--muted); font-style: italic; }

.inline-form {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}

.pill {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--info-bg);
  font-size: 0.75rem;
}

.pill-owner { background: #f0c14b; color: var(--teal-deep); }
.pill-advisor { background: #e4d7c0; }
.pill-teacher { background: #d7e8e3; }
.pill-student { background: #efe6d4; }
.pill-agent { background: #d7e8e3; }
.pill-invited { background: var(--warn-bg); }
.pill-suspended { background: #f3d6d0; }
.pill-action { background: var(--info-bg); }

.muted { color: var(--muted); }
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

pre.out {
  background: #1c211c;
  color: #f4efe6;
  padding: 0.85rem;
  border-radius: 0.55rem;
  overflow: auto;
  font-size: 0.82rem;
}

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .rail { flex-direction: row; flex-wrap: wrap; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-group { min-width: 7rem; }
  .rail-note { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .filter-form { grid-template-columns: 1fr; }
  .main { padding: 1.25rem; }
}
