:root {
  --bg: #f3f6fa;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --line: #e2e8f0;
  --accent: #169b55;
  --accent-dark: #0c7e43;
  --danger: #dc4646;
  --danger-dark: #b83232;
  --topbar-height: 72px;
  --sidebar-width: 272px;
  --sidebar-compact-width: 84px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 4px 14px rgba(24, 39, 65, 0.06);
  --shadow: 0 12px 34px rgba(24, 39, 65, 0.09);
  --shadow-lg: 0 24px 64px rgba(15, 29, 50, 0.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) #dfe7ef;
}
html { scroll-behavior: smooth; scrollbar-gutter: stable; }

/* Global scrollbar: slim, visible, and themed without blending into the page. */
html,
body {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) #dfe7ef;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track {
  background: #dfe7ef;
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb {
  min-height: 44px;
  border: 2px solid #dfe7ef;
  border-radius: 999px;
  background-color: var(--accent);
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--accent-dark); }
*::-webkit-scrollbar-thumb:active { background-color: var(--accent-dark); }
*::-webkit-scrollbar-corner { background: #dfe7ef; }
*::-webkit-scrollbar-button { width: 0; height: 0; display: none; }

/* Keep the viewport scrollbar aligned with the active role theme. */
body.role-manager { scrollbar-color: #f27419 #dfe7ef; }
body.role-validator { scrollbar-color: #7b49d0 #dfe7ef; }
body.role-facilitator { scrollbar-color: #1677d2 #dfe7ef; }
body.role-manager::-webkit-scrollbar-thumb { background-color: #f27419; }
body.role-manager::-webkit-scrollbar-thumb:hover,
body.role-manager::-webkit-scrollbar-thumb:active { background-color: #d95600; }
body.role-validator::-webkit-scrollbar-thumb { background-color: #7b49d0; }
body.role-validator::-webkit-scrollbar-thumb:hover,
body.role-validator::-webkit-scrollbar-thumb:active { background-color: #6035ae; }
body.role-facilitator::-webkit-scrollbar-thumb { background-color: #1677d2; }
body.role-facilitator::-webkit-scrollbar-thumb:hover,
body.role-facilitator::-webkit-scrollbar-thumb:active { background-color: #0c5da8; }
body { margin: 0; min-width: 0; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
body.nav-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button:disabled { opacity: 0.52; cursor: not-allowed !important; }
img { max-width: 100%; }

.role-manager { --accent: #f27419; --accent-dark: #d95600; }
.role-validator { --accent: #7b49d0; --accent-dark: #6035ae; }
.role-facilitator { --accent: #1677d2; --accent-dark: #0c5da8; }


/* Reusable vector icons */
.ui-icon {
  width: 1.15em;
  height: 1.15em;
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: -0.16em;
  stroke: currentColor;
  overflow: visible;
}

/* Accessibility */
.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  transform: translateY(-170%);
  background: #fff;
  color: var(--text);
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.7rem;
  font-size: 0.875rem;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}
.skip-link:focus { transform: translateY(0); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent), white 28%);
  outline-offset: 3px;
}

/* App shell and navigation */
.topbar {
  height: var(--topbar-height);
  background: linear-gradient(100deg, var(--accent-dark), var(--accent));
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 clamp(18px, 2vw, 34px);
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  box-shadow: 0 4px 20px rgba(13, 33, 53, 0.18);
}
.brand, .viewer-brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -0.015em; }
.brand { margin-right: auto; font-size: 1rem; }
.brand img, .viewer-brand img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}
.menu-toggle, .sidebar-close {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms ease, transform 180ms ease;
}
.menu-toggle { display: none; margin-right: 10px; font-size: 24px; }
.menu-toggle .ui-icon, .sidebar-close .ui-icon { width: 23px; height: 23px; }
.menu-toggle:hover { background: rgba(255, 255, 255, 0.13); }
.sidebar-close { display: none; color: #64748b; font-size: 27px; }
.sidebar-close:hover { background: #f1f5f9; }
.account-menu { position: relative; }
.topbar-user {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: left;
  transition: background 160ms ease;
}
.topbar-user:hover, .account-menu.is-open .topbar-user { background: rgba(255, 255, 255, 0.14); }
.user-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
}
.user-identity { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.user-name { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-identity small { margin-top: 3px; color: rgba(255, 255, 255, 0.76); font-size: 0.7rem; font-weight: 650; }
.user-chevron { display: inline-flex; align-items: center; font-size: 1rem; transition: transform 160ms ease; }
.user-chevron .ui-icon { width: 17px; height: 17px; }
.account-menu.is-open .user-chevron { transform: rotate(180deg); }
.account-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(260px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  z-index: 70;
}
.account-dropdown[hidden] { display: none; }
.account-dropdown-head { padding: 10px 11px 12px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.account-dropdown-head b, .account-dropdown-head span { display: block; }
.account-dropdown-head b { font-size: 0.9rem; }
.account-dropdown-head span { margin-top: 2px; color: var(--muted); font-size: 0.76rem; }
.account-dropdown a, .account-dropdown button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #344054;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  text-align: left;
  gap: 10px;
}
.account-dropdown a:hover, .account-dropdown button:hover { background: #f2f5f9; color: var(--accent-dark); }
.account-dropdown form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }
.account-dropdown form button:hover { background: #fff1f1; color: var(--danger-dark); }
.shell { display: flex; padding-top: var(--topbar-height); min-height: 100vh; }
.sidebar {
  width: var(--sidebar-width);
  background: rgba(255, 255, 255, 0.98);
  border-right: 1px solid var(--line);
  position: fixed;
  top: var(--topbar-height);
  bottom: 0;
  left: 0;
  padding: 24px 14px;
  overflow: auto;
  z-index: 35;
  transition: width 220ms ease, transform 220ms ease, box-shadow 220ms ease;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; }
.nav-label {
  display: block;
  padding: 0 14px 12px;
  color: #98a2b3;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.14em;
}
.nav-item {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.875rem;
  margin: 3px 0;
  border-radius: 12px;
  color: #475467;
  font-size: 0.925rem;
  font-weight: 650;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}
.nav-item:hover { background: #f2f5f9; color: #1d2939; transform: translateX(2px); }
.nav-item.active {
  background: linear-gradient(100deg, var(--accent-dark), var(--accent));
  color: #fff;
  box-shadow: 0 7px 18px color-mix(in srgb, var(--accent), transparent 76%);
}
.nav-icon { width: 22px; flex: 0 0 22px; display: inline-flex; align-items: center; justify-content: center; text-align: center; }
.nav-icon .ui-icon { width: 20px; height: 20px; }
.nav-text { white-space: nowrap; }
.logout-form { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.logout-form .nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.logout-form .nav-item:hover { background: #fff1f1; color: var(--danger-dark); }
.nav-backdrop { display: none; }
.content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-height: calc(100vh - var(--topbar-height));
  padding: clamp(26px, 2.5vw, 44px) clamp(24px, 3vw, 52px) 18px;
  transition: margin-left 220ms ease, width 220ms ease, padding 220ms ease;
}
.sidebar-compact .sidebar { width: var(--sidebar-compact-width); }
.sidebar-compact .content { margin-left: var(--sidebar-compact-width); width: calc(100% - var(--sidebar-compact-width)); }
.sidebar-compact .nav-label, .sidebar-compact .nav-text { display: none; }
.sidebar-compact .nav-item { justify-content: center; }
.sidebar-compact .nav-icon .ui-icon { width: 22px; height: 22px; }
footer { padding: 34px 0 18px; text-align: center; color: #98a2b3; font-size: 0.8rem; }

/* Typography and shared section headers */
.page-head, .panel-head, .section-title { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.page-head { margin: 0 0 26px; }
.page-head h1, .panel-head h2, .section-title h2 { margin: 0; }
.page-head h1 { font-size: clamp(1.8rem, 1.45rem + 1vw, 2.4rem); line-height: 1.12; letter-spacing: -0.035em; }
.page-head p, .panel-head p { margin: 7px 0 0; color: var(--muted); font-size: 0.95rem; line-height: 1.6; }
.panel-head h2 { font-size: 1.2rem; letter-spacing: -0.015em; }
.panel-head a { color: var(--accent); font-size: 0.9rem; font-weight: 800; }
.section-title { margin-bottom: 16px; }
.section-title h2 { font-size: clamp(1.15rem, 1rem + 0.35vw, 1.4rem); letter-spacing: -0.02em; }
.section-title span { color: var(--muted); font-size: 0.85rem; }
.title-with-icon { display: inline-flex; align-items: center; gap: 9px; }
.title-with-icon .ui-icon { width: 24px; height: 24px; color: currentColor; }

/* Dashboard and cards */
.welcome {
  margin-bottom: 22px;
  padding: clamp(24px, 2.2vw, 34px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  background: linear-gradient(110deg, var(--accent-dark), var(--accent));
  border-radius: var(--radius-lg);
  color: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.welcome::after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  right: -80px;
  top: -120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}
.welcome h1 { margin: 0 0 7px; font-size: clamp(1.5rem, 1.2rem + 0.8vw, 2rem); line-height: 1.2; }
.welcome p { margin: 0; font-size: 0.95rem; opacity: 0.94; }
.welcome > span {
  position: relative;
  z-index: 1;
  max-width: 42%;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.82rem;
  text-align: right;
  backdrop-filter: blur(8px);
}
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
.stat-card {
  min-height: 126px;
  padding: 22px;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 15px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.stat-card b { grid-row: 1/3; color: var(--accent); font-size: clamp(2rem, 1.6rem + 1vw, 2.65rem); line-height: 1; }
.stat-card span { font-size: 0.95rem; font-weight: 800; }
.stat-card small { color: var(--muted); font-size: 0.8rem; }
.panel, .viewer-panel {
  margin-bottom: 22px;
  padding: clamp(20px, 1.8vw, 28px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.action-card {
  min-height: 148px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  background: #fff;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.action-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent), white 70%); }
.action-card strong { font-size: 1rem; }
.action-card span { flex: 1; color: var(--muted); font-size: 0.86rem; line-height: 1.55; }
.action-card em { color: var(--accent); font-size: 0.82rem; font-style: normal; font-weight: 850; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
.rank-row { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 14px 0; font-size: 0.9rem; }
.rank-no { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 50%; background: #f1f4f8; font-size: 0.78rem; font-weight: 850; }
.activity, .notification-row { display: flex; gap: 12px; border-top: 1px solid var(--line); padding: 14px 0; }
.activity > span, .notice-dot { color: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.activity > span .ui-icon, .notice-dot .ui-icon { width: 18px; height: 18px; }
.activity b, .notification-row b { font-size: 0.9rem; }
.activity p, .notification-row p { margin: 3px 0; color: #536071; font-size: 0.86rem; }
.activity small, .notification-row small { color: var(--muted); font-size: 0.78rem; }
.notification-list { padding-top: 4px; }
.notification-row { padding-inline: 4px; }

/* Tables, badges, actions */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 720px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th {
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  color: #667085;
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.055em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
td { padding: 15px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 140ms ease; }
tbody tr:hover { background: #f9fbfd; }
.muted { display: block; margin-top: 3px; color: var(--muted); font-size: 0.78rem; }
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0.42rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
}
.badge.official { background: #dcfce7; color: #08763e; }
.badge.unofficial { background: #fff4cc; color: #806000; }
.badge.neutral { background: #edf1f5; color: #556070; }
.chip { display: inline-flex; align-items: center; justify-content: center; padding: 0.4rem; margin: 2px; border-radius: 999px; background: #eef6ff; color: #1762a8; font-size: 0.76rem; }
.row-actions, .result-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-actions form, .result-actions form { margin: 0; }

/* Buttons */
.btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: #344054;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(30, 45, 67, 0.1); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover:not(:disabled) { background: var(--danger-dark); border-color: var(--danger-dark); }
.btn.tiny { min-height: 38px; min-width: 38px; padding: 0.55rem; font-size: 0.8rem; }
.btn.full { width: 100%; }

/* Alerts and event context */
.alert { margin-bottom: 18px; padding: 0.875rem; border: 1px solid transparent; border-radius: 11px; font-size: 0.9rem; }
.alert.success { background: #e9f9ef; color: #0b713e; border-color: #c9eed7; }
.alert.error { background: #fff0ef; color: #982b25; border-color: #f4cfcc; }
.event-banner { margin-bottom: 18px; padding: 0.875rem; border-left: 4px solid #2478d5; border-radius: 11px; background: #edf5ff; color: #315a86; font-size: 0.9rem; }

/* Rankings */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
.podium-card {
  min-height: 148px;
  padding: 22px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "icon place points" "icon team points" "icon team label";
  align-items: center;
  gap: 4px 13px;
  border-radius: var(--radius);
  color: #fff;
  box-shadow: var(--shadow);
}
.podium-card.p1 { background: linear-gradient(135deg, #586d7d, #2f475a); }
.podium-card.p2 { background: linear-gradient(135deg, #f7b219, #f18f08); }
.podium-card.p3 { background: linear-gradient(135deg, #c36a35, #9a4924); }
.podium-card > span { grid-area: icon; display: inline-flex; align-items: center; }
.podium-card > span .ui-icon { width: 31px; height: 31px; }
.podium-card small { grid-area: place; font-size: 0.75rem; opacity: 0.86; }
.podium-card h3 { grid-area: team; margin: 2px 0; font-size: 0.95rem; }
.podium-card b { grid-area: points; font-size: 2rem; }
.podium-card em { grid-area: label; font-style: normal; font-size: 0.72rem; opacity: 0.82; text-align: right; }

/* Forms and dialogs */
dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: min(90vh, 800px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(12, 20, 32, 0.58); backdrop-filter: blur(4px); }
dialog:has(.wide) { width: min(720px, calc(100vw - 32px)); }
.modal-card { padding: 26px; }
.modal-card.wide { width: 100%; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.2rem; }
.modal-head button {
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #667085;
  cursor: pointer;
  font-size: 1.6rem;
  transition: background 160ms ease, color 160ms ease;
}
.modal-head button:hover { background: #f2f4f7; color: #344054; }
.modal-head button .ui-icon { width: 21px; height: 21px; }
.modal-card label, .login-card label, .settings-card label { display: flex; flex-direction: column; gap: 7px; margin-bottom: 15px; font-size: 0.86rem; font-weight: 750; }
.field-label { display: block; margin-bottom: 9px; font-size: 0.86rem; font-weight: 800; }
input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.8rem;
  border: 1px solid #d0d7e2;
  border-radius: 11px;
  background: #fff;
  color: #263247;
  outline: none;
  font-size: 0.94rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.password-field { position: relative; display: block; width: 100%; }
.password-field input { padding-right: 52px; }
.password-toggle {
  width: 42px;
  height: 42px;
  padding: 0;
  position: absolute;
  top: 50%;
  right: 3px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #667085;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}
.password-toggle:hover { background: #f2f5f9; color: var(--accent-dark); }
.password-toggle:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent), white 28%); outline-offset: 1px; }
.password-icon { width: 20px; height: 20px; }
.password-icon-hide { display: none; }
.password-toggle.is-visible .password-icon-show { display: none; }
.password-toggle.is-visible .password-icon-hide { display: inline-block; }

input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent), transparent 86%); }


/* Sleek select dropdown content */
.sleek-select {
  position: relative;
  width: 100%;
}
.sleek-select-native {
  position: absolute !important;
  width: 1px !important;
  min-height: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}
.sleek-select-trigger {
  width: 100%;
  min-height: 46px;
  padding: 0.8rem 2.7rem 0.8rem 0.8rem;
  border: 1px solid #d0d7e2;
  border-radius: 11px;
  background: #fff;
  color: #263247;
  outline: none;
  font: inherit;
  font-size: 0.94rem;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.sleek-select-trigger::after {
  content: "";
  width: 7px;
  height: 7px;
  position: absolute;
  top: 50%;
  right: 16px;
  border-right: 2px solid #667085;
  border-bottom: 2px solid #667085;
  transform: translateY(-68%) rotate(45deg);
  transition: transform 160ms ease;
}
.sleek-select.is-open .sleek-select-trigger::after {
  transform: translateY(-30%) rotate(225deg);
}
.sleek-select-trigger:hover:not(:disabled) { border-color: #b8c1cf; }
.sleek-select-trigger:focus-visible,
.sleek-select.is-open .sleek-select-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent), transparent 86%);
}
.sleek-select-trigger:disabled {
  cursor: not-allowed;
  background: #f7f8fa;
  color: #98a2b3;
}
.sleek-select-trigger:disabled::after { border-color: #aab2bf; }
.sleek-select-trigger[aria-invalid="true"] { border-color: var(--danger); }

.sleek-select-content {
  min-width: var(--select-width, 220px);
  max-width: min(420px, calc(100vw - 24px));
  max-height: min(320px, calc(100vh - 24px));
  margin: 0;
  padding: 6px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #e2e7ee;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(24, 35, 52, 0.16), 0 3px 10px rgba(24, 35, 52, 0.08);
  z-index: 10000;
  scrollbar-width: thin;
  scrollbar-color: #c8d0dc transparent;
}
.sleek-select-content[hidden] { display: none !important; }
.sleek-select-content:popover-open { display: block; }
.sleek-select-content::-webkit-scrollbar { width: 8px; }
.sleek-select-content::-webkit-scrollbar-track { background: transparent; }
.sleek-select-content::-webkit-scrollbar-thumb {
  border: 2px solid #fff;
  border-radius: 999px;
  background: #c8d0dc;
}
.sleek-select-option {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #344054;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  outline: none;
}
.sleek-select-option:hover:not(:disabled),
.sleek-select-option.is-focused:not(:disabled) {
  background: #f4f7fa;
  color: #202b3c;
}
.sleek-select-option.is-selected {
  background: color-mix(in srgb, var(--accent), white 91%);
  color: var(--accent-dark);
  font-weight: 750;
}
.sleek-select-option.is-selected:hover:not(:disabled),
.sleek-select-option.is-selected.is-focused:not(:disabled) {
  background: color-mix(in srgb, var(--accent), white 85%);
  color: var(--accent-dark);
}
.sleek-select-option.is-selected::after {
  content: "✓";
  margin-left: auto;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 900;
}
.sleek-select-option:disabled {
  color: #a0a8b4;
  cursor: not-allowed;
}
.sleek-select-option + .sleek-select-option { margin-top: 2px; }

@media (prefers-reduced-motion: reduce) {
  .sleek-select-trigger,
  .sleek-select-trigger::after { transition: none; }
}
input[type="checkbox"], input[type="radio"] { width: 18px; min-height: 18px; height: 18px; padding: 0; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { flex-direction: row !important; align-items: center !important; gap: 9px !important; font-weight: 600 !important; }
.sport-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; max-height: 220px; overflow: auto; margin-bottom: 15px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; }
.form-note, .warning-box { padding: 0.8rem; border-radius: 10px; background: #f7f9fc; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.warning-box { margin-bottom: 15px; border: 1px solid #ffe39a; background: #fff7dc; color: #765400; }
.result-context { margin-bottom: 15px; }
.password-rules { display: grid; gap: 6px; margin: 0 0 15px; padding: 13px; border-radius: 10px; background: #f7f9fc; color: #5e6876; font-size: 0.8rem; }
.password-rules b { margin-bottom: 3px; color: #2a3443; font-size: 0.86rem; }
.password-rules span::before { content: "× "; color: var(--danger); font-weight: 850; }
.password-rules span.is-met::before { content: "✓ "; color: var(--accent); }


.confirmation-dialog { width: min(480px, calc(100vw - 32px)); }
.confirmation-card { padding: 24px; display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; }
.confirmation-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff0ef;
  color: var(--danger-dark);
  font-size: 1.15rem;
  font-weight: 900;
}
.confirmation-icon .ui-icon { width: 22px; height: 22px; }
.confirmation-card h2 { margin: 2px 0 6px; font-size: 1.15rem; }
.confirmation-card p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.55; }
.confirmation-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
[data-sport-assignment][hidden] { display: none !important; }

/* Results and brackets */
.result-list { display: grid; gap: 14px; }
.result-card { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.result-top, .result-foot { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.result-top div { display: flex; flex-direction: column; }
.result-top b { font-size: 0.92rem; }
.result-top span:not(.badge) { color: var(--muted); font-size: 0.8rem; }
.score-entries { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 13px 0; }
.score-entries > div { padding: 12px; display: grid; grid-template-columns: 1fr auto; align-items: center; border-radius: 10px; background: #f8fafc; }
.score-entries span { font-size: 0.85rem; }
.score-entries strong { font-size: 1.25rem; }
.score-entries small { grid-column: 1/-1; color: var(--muted); font-size: 0.76rem; }
.result-foot small { color: var(--muted); font-size: 0.78rem; }
.result-notes { margin: 0 0 12px; padding: 0.75rem; border-radius: 10px; background: #f8fafc; color: #5b6675; font-size: 0.8rem; }
.judged-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.empty { padding: 30px 18px; text-align: center; color: var(--muted); font-size: 0.9rem; }
.settings-card { max-width: 720px; }
.validate-form { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.compact-check { margin: 0 !important; color: #657080; font-size: 0.76rem !important; }
.compact-check input { width: auto; }
.density-compact .result-card { padding: 12px; }
.density-compact .score-entries { margin: 8px 0; }
.density-compact td { padding-top: 10px; padding-bottom: 10px; }
.bracket-board { display: flex; gap: 18px; overflow-x: auto; padding: 10px 3px 7px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.bracket-stage { min-width: 270px; scroll-snap-align: start; }
.bracket-stage h3 { margin: 0 0 10px; color: var(--muted); font-size: 0.78rem; letter-spacing: 0.055em; text-transform: uppercase; }
.bracket-match { position: relative; display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; padding: 13px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 11px; background: #fbfcfe; }
.bracket-match b { font-size: 0.86rem; }
.bracket-match span { font-size: 0.82rem; }
.bracket-match small { color: var(--muted); font-size: 0.74rem; }
.bracket-match em { color: var(--accent); font-size: 0.74rem; font-style: normal; font-weight: 850; }

/* Login */
.login-page {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 44px);
  background:
    radial-gradient(circle at 14% 14%, rgba(22, 155, 85, 0.14), transparent 34%),
    radial-gradient(circle at 86% 86%, rgba(37, 99, 235, 0.1), transparent 30%),
    linear-gradient(145deg, #eef3f8, #f9fbfd);
}
.login-card {
  width: min(480px, 100%);
  padding: clamp(28px, 4vw, 42px);
  border: 1px solid rgba(210, 220, 232, 0.9);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 70px rgba(22, 39, 62, 0.14);
  backdrop-filter: blur(10px);
}
.login-logo { display: inline-flex; align-items: center; gap: 12px; color: #0c6d3a; font-size: 1.05rem; }
.login-logo img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.login-card h1 { margin: 28px 0 6px; font-size: clamp(1.8rem, 1.5rem + 0.7vw, 2.25rem); line-height: 1.15; letter-spacing: -0.035em; }
.login-card > p { margin: 0 0 24px; color: var(--muted); font-size: 0.95rem; }
.login-card .btn { margin-top: 4px; min-height: 48px; }
.back-link { display: inline-flex; width: 100%; align-items: center; justify-content: center; gap: 7px; margin-top: 20px; color: #667085; font-size: 0.86rem; font-weight: 650; text-align: center; }
.back-link:hover { color: var(--accent-dark); }

/* Public scoreboard */
.viewer-page { --accent: #ffce25; --accent-dark: #e0ac00; background: #edf2f7; color: #172033; }
.viewer-nav {
  height: 68px;
  padding: 0 max(20px, calc((100vw - 1440px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(6, 27, 58, 0.96);
  color: #fff;
  box-shadow: 0 4px 20px rgba(6, 27, 58, 0.22);
  backdrop-filter: blur(14px);
}
.viewer-brand { font-size: 1rem; }
.viewer-brand img { width: 42px; height: 42px; }
.viewer-nav > div { display: flex; align-items: center; gap: 12px; }
.viewer-nav > div > span { padding: 0.5rem; border-radius: 999px; background: #e2385b; font-size: 0.72rem; font-weight: 850; line-height: 1; letter-spacing: 0.05em; }
.viewer-login { min-width: 76px; background: #ffce25; border-color: #ffce25; color: #202a3a; }
.viewer-login:hover:not(:disabled) { background: #ffd74f; border-color: #ffd74f; }

.score-hero {
  min-height: calc(100svh - 68px);
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  background: #061b3a;
  color: #fff;
}
.hero-carousel, .hero-track, .hero-slide { position: absolute; inset: 0; }
.hero-carousel { z-index: -3; }
.hero-track { overflow: hidden; }
.hero-slide {
  opacity: 0;
  transform: scale(1.035);
  transition: opacity 800ms ease, transform 6.5s ease;
  pointer-events: none;
}
.hero-slide.is-active { opacity: 1; transform: scale(1); }
.hero-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 17, 37, 0.5), rgba(4, 22, 49, 0.82)),
    radial-gradient(circle at 70% 20%, rgba(20, 150, 184, 0.24), transparent 40%);
}
.hero-slide img { width: 100%; height: 100%; object-fit: cover; object-position: center; filter: saturate(0.9) brightness(0.72); }
.hero-content {
  width: min(920px, calc(100% - 40px));
  padding: clamp(72px, 11vh, 128px) 0;
  position: relative;
  z-index: 2;
  text-align: center;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.22);
}
.live-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem;
  border-radius: 999px;
  background: #ffce25;
  color: #533f00;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.04em;
  text-shadow: none;
  box-shadow: 0 8px 28px rgba(255, 206, 37, 0.18);
}
.score-hero h1 { margin: 18px 0 10px; font-size: clamp(3rem, 6vw, 6.4rem); line-height: 0.95; letter-spacing: -0.055em; }
.score-hero p { margin: 0 auto 12px; max-width: 760px; font-size: clamp(1rem, 1.2vw, 1.25rem); color: #f4f8ff; }
.score-hero small { display: block; max-width: 780px; margin: 0 auto; color: #c8d5e8; font-size: clamp(0.82rem, 0.9vw, 0.95rem); line-height: 1.6; }
.carousel-control {
  width: 50px;
  height: 50px;
  padding: 0;
  position: absolute;
  top: 50%;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;
  background: rgba(5, 20, 43, 0.38);
  color: #fff;
  cursor: pointer;
  font-size: 1.65rem;
  line-height: 1;
  backdrop-filter: blur(8px);
  transition: background 180ms ease, transform 180ms ease, border-color 180ms ease;
}
.carousel-control .ui-icon { width: 24px; height: 24px; }
.carousel-control:hover { background: rgba(5, 20, 43, 0.7); border-color: rgba(255, 255, 255, 0.55); }
.carousel-control.prev { left: clamp(14px, 3vw, 44px); }
.carousel-control.next { right: clamp(14px, 3vw, 44px); }
.carousel-dots {
  position: absolute;
  left: 50%;
  bottom: 26px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 9px;
  transform: translateX(-50%);
}
.carousel-dot {
  width: 12px;
  height: 12px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: width 180ms ease, border-radius 180ms ease, background 180ms ease;
}
.carousel-dot.is-active { width: 34px; border-radius: 999px; background: #fff; }
.viewer-content { width: min(1440px, 100%); margin: 0 auto; padding: clamp(26px, 3vw, 48px) clamp(18px, 3vw, 42px); }
.viewer-content > section:first-child { margin-bottom: 8px; }
.viewer-podium { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 26px; }
.viewer-rank {
  min-height: 180px;
  padding: 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "icon . rank" "team team team" "points points label";
  border-radius: 18px;
  color: #fff;
  box-shadow: var(--shadow);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.viewer-rank:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.viewer-rank.r1 { background: linear-gradient(145deg, #ffbb10, #ee9200); }
.viewer-rank.r2 { background: linear-gradient(145deg, #5d20cc, #7c22d6); }
.viewer-rank.r3 { background: linear-gradient(145deg, #c5642d, #93451e); }
.viewer-rank.r4 { background: linear-gradient(145deg, #4a6278, #293f53); }
.viewer-rank > span { grid-area: icon; display: inline-flex; align-items: center; }
.viewer-rank > span .ui-icon { width: 30px; height: 30px; }
.viewer-rank > b { grid-area: rank; text-align: right; font-size: 2rem; opacity: 0.45; }
.viewer-rank h3 { grid-area: team; margin: 22px 0 7px; font-size: 1.05rem; }
.viewer-rank strong { grid-area: points; font-size: clamp(1.8rem, 2.2vw, 2.55rem); line-height: 1; }
.viewer-rank small { grid-area: label; align-self: end; text-align: right; font-size: 0.78rem; }
.viewer-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
.scroll-box { max-height: 460px; overflow: auto; }
.public-result, .upcoming { padding: 14px 0; border-top: 1px solid var(--line); }
.public-result > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.public-result b, .upcoming b { font-size: 0.88rem; }
.public-result p { display: flex; justify-content: space-between; gap: 16px; margin: 7px 0; font-size: 0.86rem; }
.public-result small, .upcoming small { color: var(--muted); font-size: 0.78rem; }
.upcoming p { margin: 6px 0; font-size: 0.86rem; }
.public-bracket { display: flex; gap: 13px; max-height: 460px; overflow-x: auto; padding-bottom: 7px; }
.public-stage { min-width: 260px; }
.public-stage > b { display: block; margin-bottom: 7px; color: #667085; font-size: 0.76rem; letter-spacing: 0.05em; text-transform: uppercase; }
.public-stage .upcoming { margin-bottom: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fafbfd; }
.viewer-footer { padding: 24px 18px; background: #061b3a; color: #93a4ba; text-align: center; font-size: 0.8rem; }

/* Responsive */
@media (min-width: 1600px) {
  :root { --sidebar-width: 288px; }
  .content { padding-left: 58px; padding-right: 58px; }
  .stats-grid { gap: 22px; }
  .panel, .viewer-panel { padding: 30px; }
}

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col, .viewer-columns { grid-template-columns: 1fr; }
  .viewer-podium { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  :root { --topbar-height: 68px; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 14px; }
  .sidebar, .sidebar-compact .sidebar {
    width: min(310px, 88vw);
    transform: translateX(-103%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar .nav-label, .sidebar-compact .nav-label, .sidebar .nav-text, .sidebar-compact .nav-text { display: inline; }
  .sidebar .nav-item, .sidebar-compact .nav-item { justify-content: flex-start; }
  .sidebar-close { display: inline-flex; }
  .content, .sidebar-compact .content { width: 100%; margin-left: 0; padding: 24px 20px 16px; }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: var(--topbar-height) 0 0;
    z-index: 30;
    border: 0;
    background: rgba(11, 22, 36, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }
  .nav-open .sidebar { transform: translateX(0); }
  .nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  .podium { grid-template-columns: 1fr; }
  .score-hero { min-height: clamp(540px, calc(100svh - 68px), 780px); }
  .carousel-control { width: 46px; height: 46px; }
}

@media (max-width: 640px) {
  .user-identity, .user-chevron { display: none; }
  .topbar-user { padding-inline: 5px; }
  .brand span { font-size: 0.9rem; }
  .content, .sidebar-compact .content { padding: 20px 14px 12px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .page-head > .btn { width: 100%; }
  .stats-grid, .action-grid, .viewer-podium, .form-grid, .judged-grid { grid-template-columns: 1fr; }
  .welcome { align-items: flex-start; flex-direction: column; gap: 15px; }
  .welcome > span { max-width: none; text-align: left; }
  .sport-checks { grid-template-columns: 1fr; }
  .result-top, .result-foot { align-items: flex-start; flex-direction: column; }
  .result-actions, .validate-form { justify-content: flex-start; }
  .row-actions { min-width: 132px; }
  .modal-card { padding: 20px; }
  .panel, .viewer-panel { padding: 18px; }
  .table-wrap { margin-inline: -2px; }
  .viewer-nav { padding: 0 14px; }
  .viewer-brand b { display: none; }
  .viewer-nav > div { gap: 8px; }
  .viewer-content { padding: 24px 14px; }
  .hero-content { width: min(100% - 32px, 680px); padding: 80px 0 94px; }
  .score-hero h1 { font-size: clamp(2.7rem, 14vw, 4.2rem); }
  .score-hero p { font-size: 1rem; }
  .carousel-control { top: auto; bottom: 22px; transform: none; width: 44px; height: 44px; }
  .carousel-control.prev { left: 16px; }
  .carousel-control.next { right: 16px; }
  .carousel-dots { bottom: 37px; }
  .viewer-rank { min-height: 154px; }
  .public-result > div { align-items: flex-start; flex-direction: column; }
  .login-card { border-radius: 18px; }
}

@media (max-width: 380px) {
  .brand img { width: 36px; height: 36px; }
  .topbar { padding-inline: 10px; }
  .content, .sidebar-compact .content { padding-inline: 12px; }
  .panel, .viewer-panel, .stat-card { padding: 16px; }
  .viewer-nav > div > span { display: none; }
  .viewer-login { min-width: 68px; }
  .carousel-dots { display: none; }
}

@media print {
  .topbar, .sidebar, .nav-backdrop, .page-head .btn, footer { display: none !important; }
  .content { width: 100% !important; margin: 0 !important; padding: 0 !important; }
  .panel, .stat-card { box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .action-card:hover, .viewer-rank:hover, .btn:hover:not(:disabled), .nav-item:hover { transform: none; }
  .hero-slide { transform: none; }
}
