.text-link {
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}
.portal-loading {
  padding: 80px 0;
  text-align: center;
  color: #6a7e6e;
}
#portal {
  padding: 32px 36px 60px;
}
.portal-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 8px 0 26px;
}
.portal-title h1 {
  font:
    650 clamp(26px, 3vw, 38px)/1.2 Manrope,
    sans-serif;
  letter-spacing: -1px;
  margin: 12px 0;
}
.portal-title p {
  color: #6d7d6b;
  line-height: 1.7;
  margin: 0;
}
.portal-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
}
.portal-actions .primary {
  width: auto;
  margin: 0;
  gap: 22px;
  padding: 12px 17px;
}
.portal-actions .secondary {
  padding: 12px 16px;
}
.portal-nav {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 25px;
}
.portal-nav button {
  border: 0;
  background: none;
  padding: 14px 18px;
  color: #7f8d78;
}
.portal-nav button.active {
  color: var(--ink);
  border-bottom: 3px solid var(--ink);
  font-weight: 700;
}
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.portal-card {
  padding: 25px;
  border: 1px solid var(--line);
  background: #fbfbf5;
  border-radius: 14px;
}
.portal-card h2 {
  font: 650 21px Manrope;
  letter-spacing: -0.5px;
  margin: 12px 0;
}
.portal-card h3 {
  margin: 0 0 12px;
  font: 650 17px Manrope;
}
.portal-card p {
  color: #77836f;
  line-height: 1.8;
  font-size: 12px;
}
.portal-card .primary {
  margin-top: 20px;
}
.login-layout {
  display: grid;
  grid-template-columns: 1fr 430px;
  gap: 70px;
  align-items: center;
  max-width: 1030px;
  margin: 55px auto;
}
.login-layout h1 {
  font: 650 48px/1.2 Manrope;
  letter-spacing: -2px;
}
.login-layout em {
  font-family: Georgia;
  font-weight: 400;
  color: #bc7454;
}
.login-layout p {
  font-size: 14px;
  color: #77836f;
  line-height: 1.9;
  max-width: 470px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
.form-grid .full {
  grid-column: 1/-1;
}
.portal-form label,
.portal-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}
.portal-form input:not([type="checkbox"]),
.portal-form select,
.portal-form textarea,
.portal-input {
  display: block;
  width: 100%;
  background: #fffef8;
  border: 1px solid #cfd7c5;
  padding: 12px;
  border-radius: 7px;
  color: #294c43;
  font: inherit;
  font-size: 13px;
}
.portal-form input[type="checkbox"] {
  accent-color: #315f4e;
  width: 17px;
  height: 17px;
}
.portal-form .form-field {
  margin-bottom: 18px;
}
.portal-form .check-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 400;
  line-height: 1.7;
}
.form-error {
  color: #a43f34 !important;
  font-size: 12px;
  line-height: 1.8;
  min-height: 20px;
}
.help-text {
  font-size: 11px;
  color: #7d8a75;
  line-height: 1.8;
}
.filters {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 20px 0;
}
.filters input {
  flex: 1;
  min-width: 200px;
}
.filters select {
  max-width: 190px;
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfcf7;
}
.portal-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
  white-space: nowrap;
}
.portal-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #819075;
  background: #edf0e4;
  padding: 15px 14px;
}
.portal-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #e4e8dc;
  line-height: 1.7;
}
.portal-table tr:last-child td {
  border: 0;
}
.portal-table small {
  color: #8b9780;
  display: block;
}
.table-button {
  border: 0;
  background: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: #3d7263;
  font-size: 11px;
  padding: 5px;
}
.badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 5px;
  background: #e8eddf;
  color: #537047;
  font-size: 10px;
  white-space: nowrap;
}
.badge.live,
.badge.active {
  background: #dceadd;
  color: #366b47;
}
.badge.finished {
  background: #e7e7db;
  color: #78806a;
}
.badge.pending {
  background: #f1e4ca;
  color: #8d7445;
}
.badge.disabled {
  background: #f4dfd5;
  color: #a26750;
}
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin: 25px 0;
}
.stat {
  background: #e9eddf;
  border: 1px solid #d7dfcd;
  border-radius: 10px;
  padding: 18px;
}
.stat strong {
  display: block;
  font: 650 29px Manrope;
  margin-bottom: 6px;
}
.stat span {
  font-size: 11px;
  color: #819075;
}
.empty-state {
  text-align: center;
  color: #8a977e;
  padding: 50px 20px;
}
.empty-state h2 {
  color: #48634e;
  font: 600 23px Manrope;
}
.import-box {
  border: 1px dashed #aebea0;
  background: #edf1e5;
  padding: 22px;
  border-radius: 10px;
}
.import-box h3 {
  margin: 0 0 10px;
}
.import-box p {
  line-height: 1.8;
  font-size: 12px;
  color: #7a886f;
}
.import-preview {
  max-height: 350px;
  overflow: auto;
  margin: 20px 0;
}
.callout {
  padding: 15px 18px;
  border-radius: 8px;
  border: 1px solid #ded1b1;
  background: #f3e7ce;
  color: #897347;
  font-size: 12px;
  line-height: 1.8;
  margin: 20px 0;
}
.error-callout {
  background: #f5e5dd;
  border-color: #e0baa9;
  color: #a55e48;
}
.credentials {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #e9edde;
  padding: 18px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.9;
}
.enroll-list {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  margin: 15px 0;
}
.enroll-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid #e1e6d8;
  font-size: 12px;
}
.enroll-row input {
  accent-color: #335f4f;
  width: 17px;
  height: 17px;
}
.enroll-row small {
  color: #7e8e73;
  display: block;
  margin-top: 5px;
}
.pairing-row {
  display: grid;
  grid-template-columns: 1fr 25px 1fr 30px;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}
.pairing-row select {
  min-width: 0;
  padding: 11px 5px;
  font-size: 11px;
  border: 1px solid #cbd7bd;
  border-radius: 5px;
  background: #fffdf6;
  color: #426047;
}
.pairing-row span {
  text-align: center;
  color: #8d9c7c;
  font-size: 11px;
}
.pairing-row button {
  border: 0;
  background: none;
  font-size: 22px;
  color: #a27d69;
}
.detail-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 1fr);
  gap: 25px;
  margin: 25px 0;
}
.round-heading {
  font: 600 18px Manrope;
  margin: 25px 0 14px;
}
.match-card {
  background: #fcfcf6;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 17px;
  margin-bottom: 10px;
}
.match-card .match-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  font-size: 12px;
  margin-bottom: 10px;
}
.match-card .match-line strong {
  font-weight: 600;
}
.match-card .secondary {
  padding: 7px 10px;
}
.match-card p {
  font-size: 11px;
  color: #859176;
  line-height: 1.7;
  margin: 8px 0 0;
}
.official-layout {
  display: grid;
  grid-template-columns: minmax(320px, 650px) minmax(280px, 1fr);
  gap: 30px;
  max-width: 1100px;
  margin: auto;
}
.official-layout .game-space {
  padding: 20px;
}
.official-layout .piece {
  font-size: 18px;
}
.official-layout .board-wrap {
  grid-template-columns: 18px 1fr;
}
.official-layout .player {
  padding-left: 22px;
}
.official-tools {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}
.official-tools .primary {
  margin: 0;
  width: auto;
  gap: 20px;
}
.official-layout .history {
  height: 360px;
}
.official-note {
  margin: 0 0 18px;
  color: #76896c;
  font-size: 12px;
  line-height: 1.8;
}
.connection-label {
  font-size: 10px;
  color: #839575;
  margin: 15px 0;
}
.back-link {
  display: inline-block;
  color: #64805e;
  font-size: 12px;
  text-decoration: none;
  margin-bottom: 15px;
}
.progress {
  height: 6px;
  background: #dce4d1;
  border-radius: 5px;
  overflow: hidden;
  margin: 18px 0;
}
.progress > span {
  display: block;
  height: 100%;
  background: #4b795e;
}
.outcome-good {
  color: #457a48;
}
.outcome-bad {
  color: #a7654c;
}
.school-footer {
  padding: 30px 0 0;
  color: #919c83;
  font-size: 10px;
  border-top: 1px solid var(--line);
  margin-top: 45px;
}
#portal-dialog {
  max-width: 760px;
  width: calc(100vw - 30px);
}
#portal-dialog h2 {
  font-size: 25px;
}
#portal-dialog .portal-form p {
  font-size: 12px;
}
.portal-card button:disabled {
  cursor: wait;
}
.portal-form .primary {
  padding: 14px;
}
.grid-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.grid-actions .primary {
  margin: 0;
  width: auto;
  gap: 20px;
}
.realtime-indicator {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7c9c6a;
  margin-right: 6px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
}
@media (max-width: 900px) {
  .login-layout {
    grid-template-columns: 1fr;
    gap: 20px;
    margin: 20px auto;
    max-width: 560px;
  }
  .login-layout h1 {
    font-size: 35px;
  }
  .login-layout p {
    font-size: 13px;
  }
  .detail-columns {
    grid-template-columns: 1fr;
  }
  .official-layout {
    grid-template-columns: 1fr;
    max-width: 650px;
  }
  .portal-title {
    align-items: flex-start;
    flex-direction: column;
  }
  .stat-row {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 600px) {
  #portal {
    padding: 22px 15px 45px;
  }
  .header nav {
    gap: 10px;
  }
  .text-link,
  .header .text-button,
  .header .secondary {
    font-size: 10px;
  }
  .header .secondary {
    padding: 7px;
  }
  .header #classroom-nav {
    display: none !important;
  }
  .portal-title {
    gap: 15px;
  }
  .portal-title h1 {
    font-size: 29px;
  }
  .portal-title p {
    font-size: 12px;
  }
  .portal-card {
    padding: 20px;
  }
  .login-layout {
    margin-top: 8px;
  }
  .login-layout h1 {
    font-size: 31px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .full {
    grid-column: 1;
  }
  .portal-table {
    font-size: 11px;
  }
  .portal-table td,
  .portal-table th {
    padding: 11px 9px;
  }
  .stat {
    padding: 14px;
  }
  .stat strong {
    font-size: 23px;
  }
  .filters input {
    min-width: 100%;
  }
  .filters select {
    flex: 1;
    max-width: none;
  }
  .official-layout .game-space {
    padding: 15px 9px;
  }
  .official-layout .piece {
    font-size: clamp(12px, 3.8vw, 19px);
  }
  .official-layout .piece.fraction {
    font-size: 12px;
  }
  .pairing-row {
    grid-template-columns: 1fr 18px 1fr 25px;
    gap: 4px;
  }
  .pairing-row select {
    font-size: 10px;
  }
  .portal-actions .primary,
  .portal-actions .secondary {
    padding: 10px 13px;
    font-size: 11px;
  }
  .official-layout .history {
    height: 250px;
  }
  .portal-card p {
    font-size: 12px;
  }
  .login-layout .eyebrow {
    font-size: 8px;
  }
  .portal-nav button {
    padding: 12px;
  }
}
