[hidden] {
  display: none !important;
}

body[data-area="tribunal"] {
  --trib-yellow: #F6DE50;
  --trib-yellow-soft: #fff4a6;
  --trib-yellow-pale: #fffbe8;
  --trib-gray: #2f3339;
  --trib-gray-2: #5f646c;
  --trib-gray-soft: #ece7d5;
  --trib-border: #F6DE50;
  color: #191b20;
}

body[data-area="tribunal"] .app-bg,
body[data-area="tribunal"] {
  background:
    radial-gradient(circle at 18% 12%, rgba(246, 222, 80, .22), transparent 30%),
    radial-gradient(circle at 84% 20%, rgba(47, 51, 57, .14), transparent 28%),
    linear-gradient(135deg, var(--trib-yellow-pale), #eee8d5);
}

body[data-area="tribunal"] .sidebar {
  background: linear-gradient(180deg, #3c4149, #22262d);
}

body[data-area="tribunal"] .brand-card,
body[data-area="tribunal"] .panel,
body[data-area="tribunal"] .app-card,
body[data-area="tribunal"] .summary-panel {
  border-color: var(--trib-border);
  background: rgba(255, 251, 232, .94);
}

body[data-area="tribunal"] .hello,
body[data-area="tribunal"] h2,
body[data-area="tribunal"] h3,
body[data-area="tribunal"] .panel-title,
body[data-area="tribunal"] .soft-link,
body[data-area="tribunal"] .top5-more,
body[data-area="tribunal"] .desktop-rank-btn,
body[data-area="tribunal"] .desktop-rank-score b,
body[data-area="tribunal"] .desktop-rank-score small,
body[data-area="tribunal"] .rank-score,
body[data-area="tribunal"] .top-score {
  color: #8a6a00;
}

body[data-area="tribunal"] .nav-btn,
body[data-area="tribunal"] .portal-role-toggle span,
body[data-area="tribunal"] .portal-field input,
body[data-area="tribunal"] .portal-field select,
body[data-area="tribunal"] .ranking-search,
body[data-area="tribunal"] .portal-member-form input,
body[data-area="tribunal"] .portal-member-form select,
body[data-area="tribunal"] .portal-inline-form input,
body[data-area="tribunal"] .portal-inline-form select,
body[data-area="tribunal"] .portal-week-form input,
body[data-area="tribunal"] .portal-week-form select {
  border-color: var(--trib-border);
}

body[data-area="tribunal"] .nav-btn:hover,
body[data-area="tribunal"] .nav-btn.active,
body[data-area="tribunal"] .portal-primary,
body[data-area="tribunal"] .portal-save-btn,
body[data-area="tribunal"] .top-tab.active {
  background: linear-gradient(180deg, #fff4a6, var(--trib-yellow));
  color: #1d2026;
  box-shadow: 0 10px 22px rgba(246, 222, 80, .24);
}

body[data-area="tribunal"] .portal-role-toggle input:checked + span,
body[data-area="tribunal"] .portal-clear-btn,
body[data-area="tribunal"] .portal-sidebar-logout,
body[data-area="tribunal"] .mini-btn,
body[data-area="tribunal"] .desktop-rank-btn,
body[data-area="tribunal"] .link-btn,
body[data-area="tribunal"] .top5-more {
  border-color: var(--trib-border);
  background: var(--trib-yellow-pale);
  color: #6f5500;
}

body[data-area="tribunal"] .metric,
body[data-area="tribunal"] .member-card,
body[data-area="tribunal"] .ranking-card,
body[data-area="tribunal"] .health-card,
body[data-area="tribunal"] .portal-week-row {
  border-color: var(--trib-border);
  background: #fffaf0;
}

body[data-area="tribunal"] .desktop-bar,
body[data-area="tribunal"] .top-bar {
  background: #eee7d7;
}

body[data-area="tribunal"] .desktop-bar i.points,
body[data-area="tribunal"] .top-bar i {
  background: linear-gradient(90deg, var(--trib-yellow), #7b8088);
}

body[data-area="tribunal"] .desktop-bar i.checks,
body[data-area="tribunal"] .line-ver {
  stroke: var(--trib-yellow);
}

body[data-area="tribunal"] .line-feed {
  stroke: #7b8088;
}

body[data-area="tribunal"] .point-ver,
body[data-area="tribunal"] .legend-dot.purple {
  fill: var(--trib-yellow);
  background: var(--trib-yellow);
}

body[data-area="tribunal"] .point-feed,
body[data-area="tribunal"] .legend-dot.teal {
  fill: #7b8088;
  background: #7b8088;
}

body[data-area="tribunal"] .team-line.green,
body[data-area="tribunal"] .team-row.green {
  background: var(--trib-yellow-pale);
  color: #6f5500;
}

body[data-area="tribunal"] .team-line.blue,
body[data-area="tribunal"] .team-row.blue {
  background: #eceff2;
  color: #3b414a;
}

body[data-area="tribunal"] .team-line.gold,
body[data-area="tribunal"] .team-row.gold {
  background: var(--trib-yellow-soft);
  color: #6f5500;
}

body[data-area="tribunal"] .test-group-card {
  border-color: color-mix(in srgb, var(--group-color) 45%, var(--trib-border));
  background: linear-gradient(180deg, color-mix(in srgb, var(--group-color) 10%, var(--trib-yellow-pale)), #fffaf0);
}

body[data-area="tribunal"] .test-result-pill.approved,
body[data-area="tribunal"] .test-result-pill.obs {
  background: var(--trib-yellow-soft);
  color: #6f5500;
}

body[data-area="tribunal"] .test-result-pill.failed {
  background: #eceff2;
  color: #3b414a;
}

[data-role="membro"] [data-admin] {
  display: none !important;
}

.portal-login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 315px minmax(360px, 640px);
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 28px;
}

.portal-login-panel {
  padding: 32px;
}

.portal-login-panel h1 {
  margin: 4px 0 10px;
  color: #172033;
  font-size: clamp(42px, 5vw, 64px);
  line-height: 1;
}

.portal-login-panel h1 span {
  font-size: 0.72em;
}

.portal-login-panel p {
  color: #627083;
  margin: 0;
}

.portal-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

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

.portal-role-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.portal-role-toggle span {
  min-height: 54px;
  display: grid;
  place-items: center;
  border: 2px solid var(--trib-border);
  border-radius: 18px;
  background: #fffaf1;
  color: #627083;
  font-weight: 900;
}

.portal-role-toggle input:checked + span {
  border-color: var(--trib-border);
  background: var(--trib-yellow-pale);
  color: #6f5500;
}

.portal-field {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

.portal-field span,
.portal-member-form span {
  color: #627083;
  font-size: 13px;
}

.portal-field input,
.portal-field select,
.portal-member-form input,
.portal-member-form select {
  width: 100%;
  min-height: 50px;
  border: 2px solid var(--trib-border);
  border-radius: 18px;
  background: #fffdf9;
  color: #172033;
  padding: 0 16px;
  outline: none;
  font: inherit;
}

.portal-primary,
.portal-save-btn,
.portal-clear-btn,
.portal-sidebar-logout,
.mini-btn {
  min-height: 46px;
  border: 0;
  border-radius: 16px;
  font-weight: 900;
  cursor: pointer;
  font: inherit;
}

.portal-primary,
.portal-save-btn {
  background: linear-gradient(180deg, #fff4a6, var(--trib-yellow));
  color: #1d2026;
  box-shadow: 0 10px 22px rgba(47, 51, 57, 0.16);
}

.portal-clear-btn,
.portal-sidebar-logout,
.mini-btn {
  border: 2px solid var(--trib-border);
  background: var(--trib-yellow-pale);
  color: #6f5500;
  padding: 0 14px;
}

.mini-btn {
  min-height: 34px;
  font-size: 13px;
}

.mini-btn.danger {
  background: #eceff2;
  color: #2f3339;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: #cf294d;
  font-weight: 800;
}

.portal-sidebar-logout {
  width: 100%;
}

.portal-member-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.portal-member-form label {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

.portal-member-form .wide {
  grid-column: span 2;
}

.portal-status-filter {
  margin-top: 10px;
}

.portal-member-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.portal-head-actions,
.portal-mobile-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.portal-action-btn {
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff4a6, var(--trib-yellow));
  color: #1d2026;
  padding: 0 18px;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(47, 51, 57, 0.16);
  cursor: pointer;
}

.portal-notice {
  min-height: 20px;
  margin: 0 0 12px;
  color: #627083;
  font-weight: 800;
}

.portal-notice:empty {
  display: none;
}

.portal-notice[data-type="success"] {
  color: #12925a;
}

.portal-notice[data-type="error"] {
  color: #cf294d;
}

.portal-inline-form,
.portal-week-form {
  margin: 14px 0 18px;
  border: 2px solid var(--trib-border);
  border-radius: 22px;
  background: rgba(255, 253, 249, 0.96);
  padding: 18px;
  box-shadow: 0 14px 28px rgba(47, 51, 57, 0.10);
}

.portal-inline-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.portal-inline-form.avatar-only {
  grid-template-columns: minmax(260px, 1fr) auto;
}

.portal-inline-title,
.portal-inline-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.portal-inline-title strong {
  color: #172033;
  font-size: 18px;
}

.portal-inline-form label,
.portal-check-field,
.portal-week-form label {
  display: grid;
  gap: 7px;
  color: #627083;
  font-size: 13px;
  font-weight: 900;
}

.portal-inline-form input,
.portal-inline-form select,
.portal-week-form input,
.portal-week-form select {
  width: 100%;
  min-height: 48px;
  border: 2px solid var(--trib-border);
  border-radius: 16px;
  background: #fffdf9;
  color: #172033;
  padding: 0 14px;
  outline: none;
  font: inherit;
  font-weight: 800;
}

.portal-inline-form .wide {
  grid-column: span 2;
}

.portal-check-line {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--trib-border);
  border-radius: 16px;
  background: #fffdf9;
  padding: 0 14px;
  color: #172033;
  font-weight: 900;
}

.portal-check-line input {
  width: 18px;
  height: 18px;
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 0;
  accent-color: var(--trib-yellow);
  flex: 0 0 auto;
}

.rank-card {
  position: relative;
}

.up-badge {
  position: absolute;
  top: 9px;
  right: 12px;
  z-index: 5;
  min-width: 76px;
  display: grid;
  place-items: center;
  padding: 6px 10px;
  border: 2px solid #fff;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--trib-yellow), #2f3339);
  box-shadow: 0 10px 18px rgba(47, 51, 57, 0.18);
  color: #1d2026;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  transform: rotate(2deg);
}

.up-badge b {
  font-size: 13px;
  letter-spacing: 0;
}

.up-badge span {
  margin-top: 2px;
  font-size: 10px;
  white-space: nowrap;
}

.portal-avatar-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.portal-avatar-tools .portal-upload-btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--trib-border);
  border-radius: 16px;
  background: var(--trib-yellow-pale);
  color: #6f5500;
  padding: 0 14px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.portal-avatar-tools .portal-upload-btn input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.portal-avatar-preview {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #f7f7f7;
  overflow: hidden;
  flex: 0 0 auto;
}

.portal-avatar-preview img,
.portal-icon-choice img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portal-icon-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 10px;
}

.portal-icon-choice {
  width: 58px;
  height: 58px;
  border: 2px solid var(--trib-border);
  border-radius: 50%;
  background: #fff;
  padding: 3px;
  cursor: pointer;
  overflow: hidden;
}

.portal-icon-choice.active {
  border-color: var(--trib-border);
  box-shadow: 0 0 0 4px rgba(246, 222, 80, 0.24);
}

.portal-week-meta {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(220px, 1fr);
  gap: 12px;
}

.portal-week-legend {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
  color: #627083;
  font-weight: 800;
}

.portal-week-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
  padding: 12px;
  border: 2px solid var(--trib-border);
  border-radius: 18px;
  background: rgba(246, 222, 80, 0.16);
}

.portal-week-list {
  display: grid;
  gap: 10px;
  max-height: min(58vh, 620px);
  overflow: auto;
  padding-right: 4px;
}

.portal-week-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) repeat(6, minmax(92px, 1fr)) minmax(92px, .7fr);
  gap: 10px;
  align-items: end;
  border: 2px solid var(--trib-border);
  border-radius: 18px;
  padding: 12px;
  background: #fffaf1;
}

.portal-week-person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.portal-week-person strong {
  display: block;
  color: #172033;
  font-size: 16px;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-week-person span {
  color: #8d86a1;
  font-weight: 800;
}

.portal-week-total {
  min-height: 48px;
  border-radius: 16px;
  background: #e9f8ef;
  color: #14783f;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.portal-week-total strong {
  font-size: 24px;
  line-height: 1;
}

.portal-week-total span {
  font-size: 12px;
}

.portal-week-row.is-inactive .portal-week-total {
  background: #eceff2;
  color: #3b414a;
}

.rank-warning {
  margin-top: 6px;
  color: #3b414a;
  font-size: 12px;
  font-weight: 900;
}

body[data-area="tribunal"] .metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

body[data-area="tribunal"] .metric-title span {
  font-size: 11px;
  line-height: 1.1;
}

.test-shell {
  display: grid;
  gap: 14px;
  width: 100%;
  height: auto !important;
  margin: 0;
}

.test-board-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 14px;
  width: 100%;
  height: auto !important;
  margin: 0;
}

@media (max-width: 1280px) {
  .test-board-grid {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
  }
}

.test-shell.mobile .test-board-grid {
  grid-template-columns: 1fr;
}

.test-admin-panel {
  display: grid;
  gap: 12px;
  border: 2px solid var(--trib-border);
  border-radius: 22px;
  padding: 14px;
  background: rgba(255, 250, 241, 0.82);
}

.test-admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.test-admin-head strong,
.test-admin-head span {
  display: block;
}

.test-admin-head strong {
  color: #172033;
  font-size: 18px;
}

.test-admin-head span {
  color: #627083;
  font-weight: 800;
  font-size: 13px;
}

.test-editor {
  display: grid;
  gap: 12px;
}

.test-editor-grid {
  display: grid;
  grid-template-columns: minmax(150px, .7fr) minmax(220px, 1fr);
  gap: 10px;
}

.test-editor-grid .wide {
  grid-column: 1 / -1;
}

.test-editor select {
  width: 100%;
}

.test-group-card {
  --group-color: #a8a29e;
  border: 2px solid color-mix(in srgb, var(--group-color) 48%, var(--trib-border));
  border-radius: 22px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--group-color) 12%, #fffaf1), #fffdf9);
  padding: 14px;
  min-width: 0;
  box-shadow: 0 12px 22px rgba(47, 51, 57, 0.08);
}

.test-group-card.tone-gold { --group-color: var(--trib-yellow); }
.test-group-card.tone-pink { --group-color: #ff6fa8; }
.test-group-card.tone-blue { --group-color: #4a8df8; }
.test-group-card.tone-green { --group-color: #20b486; }
.test-group-card.tone-yellow { --group-color: #ffd23f; }
.test-group-card.tone-purple { --group-color: #8b5cf6; }
.test-group-card.tone-red { --group-color: #f05d68; }
.test-group-card.tone-orange { --group-color: #ff9f43; }
.test-group-card.tone-cyan { --group-color: #22c7d8; }
.test-group-card.tone-gray { --group-color: #8a8f98; }

.test-group-card header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.test-group-card header {
  margin-bottom: 12px;
}

.test-card-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.test-color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--group-color);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--group-color) 20%, transparent);
  flex: 0 0 auto;
}

.test-group-card h3,
.test-group-card small,
.test-instructor > span {
  margin: 0;
}

.test-group-card h3 {
  color: #172033;
  font-size: 18px;
  line-height: 1;
}

.test-group-card small,
.test-instructor > span {
  color: #627083;
  font-size: 12px;
  font-weight: 900;
}

.test-instructor {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid color-mix(in srgb, var(--group-color) 30%, var(--trib-border));
}

.test-roster {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.test-person {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
}

.test-person .member-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
}

.test-person-main {
  min-width: 0;
}

.test-person b,
.test-person small,
.test-person-main span {
  display: block;
}

.test-person b {
  color: #172033;
  font-size: 15px;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.test-person small,
.test-person-main span {
  color: #778196;
  font-size: 12px;
  font-weight: 800;
}

.test-person-side {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.test-person-side strong {
  color: #8a6a00;
  font-size: 16px;
  white-space: nowrap;
}

.test-result-pill {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.test-result-pill.approved {
  background: #e7f8ef;
  color: #118351;
}

.test-result-pill.obs {
  background: #fff3cb;
  color: #946500;
}

.test-result-pill.failed {
  background: #eceff2;
  color: #3b414a;
}

.test-result-pill.neutral {
  background: #edf2f7;
  color: #556174;
}

.test-result-table {
  width: 100%;
}

.test-result-table th,
.test-result-table td {
  white-space: nowrap;
}

.test-result-card {
  display: grid;
  gap: 8px;
}

.test-result-card em {
  justify-self: start;
  font-style: normal;
}

.empty-state.compact {
  padding: 10px;
  border-radius: 14px;
}

.highlight-list {
  display: grid;
  gap: 12px;
  width: 100%;
}

.highlight-card {
  display: grid;
  grid-template-columns: 34px 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 74px;
  padding: 10px;
  border: 2px solid var(--trib-border);
  border-radius: 18px;
  background: #fffaf1;
}

.highlight-rank {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--trib-yellow-pale);
  color: #6f5500;
  font-weight: 900;
}

.highlight-card.top-1 .highlight-rank {
  background: #fff3cb;
  color: #9a6a00;
}

.highlight-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  overflow: hidden;
  background: #f7f7f7;
  display: grid;
  place-items: center;
}

.highlight-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.highlight-avatar span,
.highlight-card strong {
  color: #172033;
  font-weight: 900;
}

.highlight-card span {
  color: #8d86a1;
  font-weight: 800;
}

.highlight-card b {
  color: #8a6a00;
  white-space: nowrap;
}

.empty-state {
  border: 2px dashed var(--trib-border);
  border-radius: 18px;
  color: #627083;
  padding: 24px;
  text-align: center;
  font-weight: 800;
}

.portal-mobile-shell {
  display: none;
}

@media (min-width: 851px) {
  #members.page.active {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 14px;
    overflow: hidden;
  }

  #members .page-head {
    margin-bottom: 0;
  }

  #members .ranking-panel {
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #teamCardsDesktop.team-cards {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
  }
}

@media (min-width: 851px) {
  .portal-desktop-shell {
    display: block;
  }

  .portal-mobile-shell {
    display: none !important;
  }

  .portal-desktop-shell .brand-card {
    flex: 0 0 clamp(292px, 35vh, 330px);
    height: clamp(292px, 35vh, 330px);
    padding: 6px 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .portal-desktop-shell .brand-card .mascot {
    height: clamp(278px, 33vh, 306px);
    margin: -14px auto -68px;
  }

  .portal-desktop-shell .brand-card .logo {
    width: 108%;
    max-height: 96px;
    margin: 0 0 0 -4%;
  }

  body[data-area="gifs"] .portal-desktop-shell .brand-card .mascot {
    height: clamp(292px, 34vh, 318px);
    margin: -6px auto 0;
  }

  body[data-area="tribunal"] .brand-card .mascot,
  body[data-area="tribunal"] .portal-desktop-shell .brand-card .mascot {
    width: min(82%, 246px);
    height: auto;
    max-height: 250px;
    margin: 0 auto;
    object-fit: contain;
  }

  #teamCardsDesktop .member-card-team {
    position: relative;
  }

  #teamCardsDesktop .portal-member-actions {
    position: absolute;
    right: 18px;
    bottom: 10px;
    z-index: 3;
    justify-content: flex-end;
    gap: 6px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
  }

  #teamCardsDesktop .member-card-team:hover .portal-member-actions {
    opacity: 1;
    pointer-events: auto;
  }

  #teamCardsDesktop .portal-member-actions.self-actions {
    opacity: 1;
    pointer-events: auto;
  }

  #teamCardsDesktop .portal-member-actions .mini-btn {
    min-height: 28px;
    border-radius: 10px;
    padding: 0 9px;
    font-size: 12px;
  }

  .portal-desktop-shell .desktop-rank-card {
    height: 400px;
    min-height: 400px;
    padding: 20px;
  }

  .portal-desktop-shell .desktop-grid-top {
    align-items: stretch;
  }

  .portal-desktop-shell .desktop-team-card {
    height: 400px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    padding: 20px;
  }

  .portal-desktop-shell .desktop-rank-card .desktop-top-row {
    grid-template-columns: 34px 42px minmax(0, 1fr) 58px;
    gap: 10px;
    padding: 6px 0;
    min-height: 55px;
  }

  .portal-desktop-shell .desktop-rank-card .desktop-avatar {
    width: 42px;
    height: 42px;
  }

  .portal-desktop-shell .desktop-rank-card .desktop-medal {
    font-size: 20px;
  }

  .portal-desktop-shell .desktop-rank-card .desktop-medal span {
    width: 26px;
    height: 26px;
    font-size: 14px;
  }

  .portal-desktop-shell .desktop-rank-card .desktop-rank-info strong {
    font-size: 14px;
    line-height: 1.1;
  }

  .portal-desktop-shell .desktop-rank-card .desktop-rank-info small {
    font-size: 11px;
    margin-top: 1px;
  }

  .portal-desktop-shell .desktop-rank-card .desktop-bar {
    height: 8px;
    margin-top: 5px;
  }

  .portal-desktop-shell .desktop-rank-card .desktop-rank-score b {
    font-size: 20px;
  }

  .portal-desktop-shell .desktop-rank-card .desktop-rank-score small {
    font-size: 11px;
  }

  .portal-desktop-shell .desktop-rank-card .desktop-rank-btn {
    margin-top: 8px;
    padding: 9px 10px;
  }

  .portal-desktop-shell .desktop-top10-card {
    grid-column: span 2;
  }

  .portal-desktop-shell .desktop-top10-card #topCombined {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
    grid-auto-flow: column;
    column-gap: 18px;
    overflow: hidden;
  }

  .portal-desktop-shell .desktop-top10-card .desktop-top-row {
    grid-template-columns: 28px 34px minmax(0, 1fr) 112px;
    min-height: 0;
    padding: 4px 0;
  }

  .portal-desktop-shell .desktop-top10-card .desktop-avatar {
    width: 34px;
    height: 34px;
  }

  .portal-desktop-shell .desktop-top10-card .desktop-medal {
    font-size: 16px;
  }

  .portal-desktop-shell .desktop-top10-card .desktop-medal span {
    width: 23px;
    height: 23px;
    font-size: 12px;
  }

  .portal-desktop-shell .desktop-top10-card .desktop-rank-info strong {
    font-size: 13px;
  }

  .portal-desktop-shell .desktop-top10-card .desktop-rank-info small {
    font-size: 10px;
  }

  .portal-desktop-shell .desktop-top10-card .desktop-bar {
    height: 6px;
    margin-top: 3px;
  }

  .desktop-rank-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    align-items: center;
  }

  .desktop-rank-metrics span {
    min-width: 0;
    display: grid;
    justify-items: end;
    color: #8a6a00;
    font-weight: 900;
    line-height: 1;
  }

  .desktop-rank-metrics b {
    font-size: 16px;
  }

  .desktop-rank-metrics small {
    margin-top: 2px;
    color: #8b7d9b;
    font-size: 9px;
    text-transform: uppercase;
  }

  .portal-desktop-shell .health-graph .large-chart {
    width: min(100%, 960px);
    height: 210px;
    margin: 4px 0 0;
  }

  .portal-desktop-shell .health-graph .large-chart svg {
    width: 100%;
    height: 210px;
    margin-top: 0;
  }
}

@media (max-width: 850px) {
  .decor {
    display: none;
  }

  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .portal-login {
    min-height: 100vh;
    display: block;
    padding: 12px;
  }

  .portal-login-brand {
    display: none;
  }

  .portal-login-panel {
    border-radius: 34px;
    padding: 24px 18px;
  }

  .portal-login-panel h1 {
    font-size: clamp(36px, 10vw, 58px);
  }

  .portal-desktop-shell {
    display: none !important;
  }

  .portal-mobile-shell {
    display: block;
  }

  body[data-area="tribunal"] .hero-mascot {
    width: min(82%, 280px);
    max-width: 280px;
    align-self: center;
    justify-self: center;
    margin: 0;
    object-fit: contain;
  }

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

  .portal-member-form .wide {
    grid-column: auto;
  }

  .portal-member-actions {
    justify-content: flex-start;
  }

  .portal-member-actions .mini-btn {
    flex: 1 1 auto;
  }

  .portal-mobile-shell .up-badge {
    top: 8px;
    right: 10px;
    min-width: 62px;
    padding: 5px 8px;
    border-radius: 12px;
  }

  .portal-mobile-shell .up-badge b {
    font-size: 11px;
  }

  .portal-mobile-shell .up-badge span {
    font-size: 8px;
    max-width: 76px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .portal-mobile-shell .top5-header h2 {
    font-size: clamp(29px, 8.2vw, 34px);
    line-height: 1.05;
    white-space: nowrap;
  }

  .portal-mobile-shell .mobile-summary-card h2 {
    font-size: clamp(24px, 7.2vw, 30px);
    line-height: 1.08;
  }

  .portal-mobile-shell .top-member {
    display: grid;
    grid-template-columns: 34px 64px minmax(0, 1fr) 66px;
    align-items: center;
    gap: 10px;
    min-height: 92px;
    padding: 14px 0;
    border-bottom: 2px solid rgba(246, 222, 80, 0.42);
  }

  .portal-mobile-shell .top-member-combined {
    grid-template-columns: 34px 56px minmax(0, 1fr) 78px;
    gap: 8px;
    min-height: 78px;
    padding: 10px 0;
  }

  .portal-mobile-shell .top-member:last-child {
    border-bottom: 0;
  }

  .portal-mobile-shell .top-pos {
    display: grid;
    place-items: center;
    min-width: 0;
    font-size: 24px;
    font-weight: 900;
    color: #8a6a00;
  }

  .portal-mobile-shell .top-pos span {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--trib-yellow-pale);
  }

  .portal-mobile-shell .top-avatar {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: #f7f7f7;
  }

  .portal-mobile-shell .top-member-combined .top-avatar {
    width: 56px;
    height: 56px;
  }

  .portal-mobile-shell .top-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .portal-mobile-shell .top-avatar span {
    font-size: 26px;
    font-weight: 900;
    color: #172033;
  }

  .portal-mobile-shell .top-score.dual {
    display: grid;
    gap: 5px;
    justify-items: end;
  }

  .portal-mobile-shell .top-score.dual span {
    display: grid;
    justify-items: end;
    line-height: 1;
  }

  .portal-mobile-shell .top-score.dual strong {
    font-size: 22px;
  }

  .portal-mobile-shell .top-score.dual small {
    color: #8a6a00;
    font-size: 11px;
    font-weight: 900;
  }

  .portal-mobile-shell .top-info {
    min-width: 0;
  }

  .portal-mobile-shell .top-info strong {
    display: inline-block;
    max-width: calc(100% - 52px);
    overflow: hidden;
    color: #172033;
    font-size: clamp(20px, 5.7vw, 32px);
    line-height: 1.05;
    text-overflow: ellipsis;
    vertical-align: bottom;
    white-space: nowrap;
  }

  .portal-mobile-shell .top-info span {
    margin-left: 6px;
    color: #8b7d9b;
    font-size: clamp(14px, 3.6vw, 20px);
    white-space: nowrap;
  }

  .portal-mobile-shell .top-bar {
    height: 12px;
    overflow: hidden;
    margin-top: 7px;
    border-radius: 999px;
    background: #eee7d7;
  }

  .portal-mobile-shell .top-bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ffc94d, #ff8f3f);
  }

  .portal-mobile-shell .top-score {
    min-width: 0;
    color: #8a6a00;
    text-align: right;
    font-weight: 900;
  }

  .portal-mobile-shell .top-score strong {
    display: block;
    font-size: clamp(26px, 7vw, 40px);
    line-height: 1;
  }

  .portal-mobile-shell .top-score span {
    display: block;
    margin-top: 2px;
    font-size: clamp(15px, 4vw, 22px);
    line-height: 1;
  }

  .portal-mobile-shell .member-card-team {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 0;
    padding: 16px;
  }

  .portal-mobile-shell .member-card-team .member-left {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    min-width: 0;
    width: 100%;
  }

  .portal-mobile-shell .member-card-team .member-avatar {
    width: 56px;
    height: 56px;
  }

  .portal-mobile-shell .member-card-team .member-info {
    min-width: 0;
  }

  .portal-mobile-shell .member-card-team .member-name {
    overflow: hidden;
    font-size: clamp(24px, 7vw, 36px);
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .portal-mobile-shell .member-card-team .member-id {
    font-size: clamp(16px, 4.5vw, 24px);
    line-height: 1.15;
  }

  .portal-mobile-shell .member-card-team .member-role {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    max-width: 96px;
    color: #172033;
    font-size: clamp(16px, 4.5vw, 22px);
    line-height: 1.15;
    text-align: right;
  }

  .portal-mobile-shell .member-card-team .portal-member-actions {
    grid-column: 1 / -1;
    display: flex;
    width: 100%;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
  }

  .portal-mobile-shell .member-card-team .portal-member-actions .mini-btn {
    flex: 0 0 auto;
    min-height: 34px;
    border-radius: 14px;
    padding: 0 12px;
    font-size: clamp(12px, 3.4vw, 15px);
    line-height: 1;
  }

  .portal-mobile-search {
    margin: 12px 0 14px;
  }

  .portal-mobile-actions,
  .portal-head-actions {
    width: 100%;
    justify-content: stretch;
  }

  .portal-mobile-actions select,
  .portal-head-actions select,
  .portal-action-btn {
    width: 100%;
  }

  .portal-inline-form,
  .portal-inline-form.mobile {
    grid-template-columns: 1fr;
    border-radius: 28px;
    padding: 16px;
  }

  .portal-inline-form .wide {
    grid-column: auto;
  }

  .portal-avatar-tools,
  .portal-inline-actions,
  .portal-inline-title {
    align-items: stretch;
  }

  .portal-avatar-tools .portal-clear-btn,
  .portal-inline-actions button,
  .portal-inline-title button {
    width: 100%;
  }

  .portal-week-form,
  .portal-week-form.mobile {
    border-radius: 28px;
    padding: 16px;
  }

  .portal-week-meta,
  .portal-week-summary,
  .portal-week-row {
    grid-template-columns: 1fr;
  }

  .portal-week-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .portal-week-person strong {
    white-space: normal;
  }

  .portal-week-total {
    min-height: 68px;
  }

  .test-admin-head,
  .test-card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .test-editor-grid {
    grid-template-columns: 1fr;
  }

  .test-editor-grid .wide {
    grid-column: auto;
  }

  .test-person {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .test-person-side {
    grid-column: 2;
    justify-items: start;
  }

  body[data-area="tribunal"] .metric-app .metric-title {
    white-space: normal;
    line-height: 1.1;
  }

  .rank-info {
    line-height: 1.25;
  }
}
