/* Maryadi Partner Portal. Палитра — цвета британской школьной формы: оксфордский синий и бордовый герб. */
:root {
  color-scheme: light;
  --ink: #172a45;
  --muted: #5a6578;
  --paper: #ffffff;
  --mist: #eef1f6;
  --line: #d5dbe5;
  --crest: #7b2341;
  --error: #a3202f;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.6 var(--sans);
}

body.gate {
  background: var(--mist);
}

a {
  color: var(--ink);
  text-decoration-color: var(--crest);
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 3px solid var(--crest);
  outline-offset: 2px;
}

/* Шапка */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand img {
  display: block;
  height: 28px;
  width: auto;
}

.account {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.account-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account form {
  margin: 0;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  white-space: nowrap;
  cursor: pointer;
}

.link-button:hover {
  color: var(--ink);
}

.main {
  padding: clamp(2rem, 8vh, 5rem) var(--gutter) 4rem;
}

/* Страницы входа: одна колонка, крупный заголовок с гербовой чертой */
.gate-card {
  max-width: 30rem;
  margin: 0 auto;
}

.display {
  margin: 0 0 1rem;
  font: 600 clamp(2.25rem, 7vw, 3.25rem) / 1.1 var(--serif);
  letter-spacing: -0.01em;
}

.display::before {
  content: "";
  display: block;
  width: 3rem;
  height: 4px;
  margin-bottom: 1.5rem;
  background: var(--crest);
}

.lede {
  margin: 0 0 2rem;
  color: var(--muted);
  font-size: 1.0625rem;
  max-width: 34em;
}

.fine {
  margin: 1.75rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Формы */
.stack {
  display: grid;
  gap: 0.5rem;
}

label {
  font-weight: 500;
}

input[type="email"],
input[type="text"],
input[type="tel"],
textarea {
  width: 100%;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

input:focus-visible,
textarea:focus-visible {
  outline-offset: 0;
  border-color: var(--crest);
}

input[aria-invalid="true"] {
  border-color: var(--error);
}

.field-error {
  margin: 0;
  color: var(--error);
  font-size: 0.875rem;
}

.button {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.8rem 1.4rem;
  border: 0;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  font: 600 1rem/1.2 var(--sans);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: #0f1d31;
}

.stack .button {
  justify-self: start;
}

/* Кабинет */
.page {
  max-width: 60rem;
  margin: 0 auto;
}

.page-title {
  margin: 0 0 0.75rem;
  font: 600 clamp(1.75rem, 5vw, 2.25rem) / 1.2 var(--serif);
}

@media (max-width: 480px) {
  .stack .button {
    justify-self: stretch;
  }
}

/* Разделы кабинета */
.sections {
  display: flex;
  gap: clamp(1rem, 4vw, 2.25rem);
  padding: 0 var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.sections a {
  padding: 0.9rem 0 0.8rem;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.sections a:hover {
  color: var(--ink);
}

.sections a[aria-current="page"] {
  border-bottom-color: var(--crest);
  color: var(--ink);
}

.app .main {
  padding-top: clamp(1.5rem, 5vh, 3rem);
}

/* В кабинете шапка и разделы выровнены по колонке содержимого (60rem) */
.app .topbar,
.app .sections {
  padding-inline: max(var(--gutter), (100% - 60rem) / 2);
}

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

/* Список студентов */
.students {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.students th,
.students td {
  padding: 0.9rem 1rem 0.9rem 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.students thead th {
  padding-top: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
}

.students tbody th {
  font-weight: 600;
}

.students .sub {
  display: block;
  color: var(--muted);
  font-size: 0.875rem;
}

.status {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-active {
  background: #e3e9f3;
  color: var(--ink);
}

.status-done {
  background: var(--ink);
  color: var(--paper);
}

.status-closed {
  background: transparent;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
}

@media (max-width: 640px) {
  .students thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .students tr {
    display: block;
    padding: 1rem 0;
    border-bottom: 1px solid var(--line);
  }

  .students th,
  .students td {
    padding: 0;
    border: 0;
  }

  .students tbody th {
    display: block;
    margin-bottom: 0.5rem;
  }

  .students td {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 1rem;
    padding: 0.2rem 0;
  }

  .students td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.8125rem;
  }

  .students tbody th {
    font-size: 1.0625rem;
  }
}

/* Контакт */
.contact-card {
  max-width: 34rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--crest);
  border-radius: 4px;
}

.contact-name {
  margin: 0 0 1rem;
  font: 600 1.375rem/1.3 var(--serif);
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-links .button {
  margin-top: 0;
}

.button-quiet {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.button-quiet:hover {
  background: var(--mist);
}

/* Данные партнёра */
.details {
  display: grid;
  max-width: 40rem;
  margin: 0;
}

.detail {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

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

.detail dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  .detail {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

/* Форма передачи студента */
.refer-form {
  display: grid;
  gap: 1.25rem;
  max-width: 34rem;
}

.field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field legend {
  margin-bottom: 0.35rem;
  padding: 0;
  font-weight: 500;
}

.optional,
.hint {
  color: var(--muted);
  font-weight: 400;
}

.hint {
  margin: 0;
  font-size: 0.875rem;
}

textarea {
  resize: vertical;
}

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

.choice {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-weight: 400;
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--ink);
  background: var(--mist);
}

.choice input {
  accent-color: var(--ink);
}

.refer-form .button {
  justify-self: start;
  margin-top: 0.25rem;
}

.form-error {
  max-width: 34rem;
  margin: 0 0 1rem;
  color: var(--error);
  font-weight: 500;
}

.notice {
  max-width: 40rem;
  margin: 0 0 2rem;
  padding: 0.9rem 1.1rem;
  border-left: 4px solid var(--crest);
  background: var(--mist);
}

@media (max-width: 480px) {
  .refer-form .button {
    justify-self: stretch;
  }
}
