:root {
  color-scheme: light;
  --bg: #f5f7f7;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-subtle: #edf2f3;
  --surface-hover: #f8fafb;
  --text: #29383e;
  --text-muted: #596a71;
  --text-subtle: #65767d;
  --border: #dbe3e5;
  --border-strong: #bfcdd1;
  --accent: #2988a8;
  --accent-strong: #126f91;
  --accent-soft: #e0f2f8;
  --accent-glow: rgb(41 136 168 / 16%);
  --danger: #bd3543;
  --danger-soft: #fbeaec;
  --success: #24775e;
  --success-soft: #e4f3ee;
  --shadow-sm: 0 1px 2px rgb(30 47 53 / 5%), 0 6px 22px rgb(30 47 53 / 5%);
  --shadow-md: 0 18px 48px rgb(30 47 53 / 12%);
  --radius-sm: 9px;
  --radius: 16px;
  --radius-lg: 24px;
  --font: "Bricolage Grotesque", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Compatibilidade com os nomes usados nas telas existentes. */
  --vermelho: var(--danger);
  --ardosia: var(--text);
  --ardosia-70: var(--text-muted);
  --ardosia-40: var(--text-subtle);
  --ceu: var(--accent);
  --ceu-claro: var(--accent-soft);
  --papel: var(--surface);
  --papel-2: var(--surface-subtle);
  --linha: var(--border);
  --verde: var(--success);
  --raio: var(--radius-sm);
  --fonte: var(--font);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1315;
  --surface: #141c1f;
  --surface-raised: #182226;
  --surface-subtle: #1b272b;
  --surface-hover: #202d31;
  --text: #edf3f4;
  --text-muted: #b7c5c9;
  --text-subtle: #91a3a9;
  --border: #2a393e;
  --border-strong: #405158;
  --accent: #79c8e0;
  --accent-strong: #98d9ea;
  --accent-soft: #17313a;
  --accent-glow: rgb(121 200 224 / 18%);
  --danger: #ff808a;
  --danger-soft: #3a2025;
  --success: #72cfad;
  --success-soft: #17362d;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 20%), 0 8px 26px rgb(0 0 0 / 16%);
  --shadow-md: 0 24px 70px rgb(0 0 0 / 38%);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 92% -8%, var(--accent-glow), transparent 26rem),
    var(--bg);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  touch-action: manipulation;
}

img {
  max-width: 100%;
}

a {
  color: var(--accent-strong);
}

::selection {
  color: var(--text);
  background: var(--accent-soft);
}

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

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  color: var(--surface);
  background: var(--text);
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

.wrap {
  width: min(1220px, calc(100% - 56px));
  margin: 0 auto;
  padding-bottom: max(88px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 96px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: block;
  width: 168px;
  height: auto;
  transition: filter 180ms ease, opacity 180ms ease;
}

:root[data-theme="light"] .logo {
  filter: brightness(.66) saturate(1.25);
}

.session {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 11px;
  min-width: 0;
  text-align: right;
}

.session-copy {
  min-width: 0;
}

.session span {
  display: block;
  color: var(--text-subtle);
  font-size: 12px;
}

.session b {
  display: block;
  overflow: hidden;
  max-width: 230px;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 17%, transparent);
}

.status-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 16%, transparent);
}

.theme-toggle {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.theme-toggle:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  transform: translateY(-1px);
}

.theme-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.theme-icon-moon,
:root[data-theme="dark"] .theme-icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-icon-moon {
  display: block;
}

h1 {
  max-width: 920px;
  margin: clamp(34px, 6vw, 66px) 0 0;
  font-size: clamp(42px, 7vw, 78px);
  font-weight: 800;
  line-height: .93;
  letter-spacing: -.045em;
  text-wrap: balance;
  text-transform: lowercase;
}

.subtitle {
  max-width: 58ch;
  margin: 18px 0 0;
  color: var(--text-muted);
  font-size: 16px;
}

.score {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  overflow: hidden;
  margin-top: 34px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  scroll-snap-type: x proximity;
  overscroll-behavior-inline: contain;
}

.score > div {
  flex: 1 1 130px;
  min-width: 115px;
  padding: 17px 20px;
  border-right: 1px solid var(--border);
  scroll-snap-align: start;
}

.score > div:last-child {
  border-right: 0;
}

.score b {
  display: block;
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: -.035em;
}

.score b.small {
  padding-top: 7px;
  font-size: 15px;
  letter-spacing: -.01em;
}

.score span,
.eyebrow {
  color: var(--text-subtle);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.nav-shell {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 22px -12px 28px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  backdrop-filter: blur(14px);
}

.tabs {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.tabs button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 14px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  text-transform: lowercase;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.tabs button:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.tabs button[aria-current="page"] {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
  font-weight: 700;
}

.nav-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.nav-more {
  position: relative;
  margin-left: auto;
}

.nav-more .nav-icon {
  width: 17px;
  height: 17px;
}

.nav-label-mobile {
  display: none;
}

.nav-chevron {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: transform 150ms ease;
}

.nav-more[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
}

.nav-panel {
  position: absolute;
  top: calc(100% - 3px);
  right: 12px;
  width: min(760px, calc(100vw - 56px));
  max-height: min(72vh, 640px);
  overflow-y: auto;
  padding: 18px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-raised) 97%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  animation: nav-panel-in 160ms cubic-bezier(.2, .8, .2, 1);
}

.nav-panel.compact {
  width: min(380px, calc(100vw - 56px));
}

.nav-panel.open-up {
  top: auto;
  bottom: calc(100% - 3px);
  transform-origin: bottom right;
}

.nav-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 2px 2px 13px;
  border-bottom: 1px solid var(--border);
}

.nav-panel-head b {
  display: block;
  margin-top: 2px;
  font-size: 18px;
  letter-spacing: -.02em;
  text-transform: lowercase;
}

.nav-panel-close {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 23px;
  cursor: pointer;
}

.nav-panel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
}

.nav-group {
  min-width: 0;
  padding: 9px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 13px;
}

.nav-group-label {
  display: block;
  padding: 5px 7px 8px;
  color: var(--text-subtle);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.nav-option {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 66px;
  padding: 8px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.nav-option + .nav-option {
  margin-top: 3px;
}

.nav-option:hover {
  background: var(--surface);
  border-color: var(--border);
  transform: translateY(-1px);
}

.nav-option[aria-current="page"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
}

.nav-option-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--accent-strong);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.nav-option-icon .nav-icon {
  width: 19px;
  height: 19px;
}

.nav-option b,
.nav-option small {
  display: block;
}

.nav-option b {
  font-size: 13px;
  line-height: 1.2;
  text-transform: lowercase;
}

.nav-option small {
  margin-top: 3px;
  color: var(--text-subtle);
  font-size: 10px;
  line-height: 1.25;
}

.nav-panel-footer {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

@keyframes nav-panel-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(.99);
  }
}

#stage:focus {
  outline: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 18px;
}

.card,
.block {
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card {
  position: relative;
  overflow: hidden;
  min-height: 258px;
  padding: 0;
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 14px 34px rgb(31 52 59 / 10%);
  transform: translateY(-3px);
}

.card::before {
  display: block;
  height: 5px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 30%, transparent));
  content: "";
}

.card-body {
  padding: 20px 21px 0;
}

.card h3 {
  max-width: calc(100% - 28px);
  margin: 6px 0 4px;
  font-size: 23px;
  line-height: 1.12;
  letter-spacing: -.03em;
  text-transform: lowercase;
}

.card .when,
.card .where {
  color: var(--text-muted);
  font-size: 13px;
}

.card .where {
  min-height: 44px;
  margin: 12px 0 16px;
}

.card-foot {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px 21px 17px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.card-foot span {
  min-width: 0;
}

.card-foot span:last-child {
  text-align: right;
}

.card-foot b {
  display: block;
  color: var(--text);
  font-size: 18px;
}

.cross {
  position: absolute;
  top: 19px;
  right: 19px;
  color: var(--accent);
  font-size: 24px;
  font-weight: 300;
}

.block {
  padding: clamp(20px, 3vw, 28px);
}

.block + .block {
  margin-top: 18px;
}

h2 {
  position: relative;
  margin: 0 0 5px;
  padding-left: 17px;
  font-size: clamp(23px, 3vw, 27px);
  line-height: 1.18;
  letter-spacing: -.03em;
  text-wrap: balance;
  text-transform: lowercase;
}

h2::before {
  position: absolute;
  inset: .22em auto .12em 0;
  width: 4px;
  background: var(--accent);
  border-radius: 99px;
  content: "";
}

h3 {
  line-height: 1.25;
}

.legend {
  max-width: 70ch;
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 13.5px;
}

.legend b {
  color: var(--text);
}

.row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.row.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: block;
  margin: 0 0 7px;
  color: var(--text-subtle);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-subtle);
  opacity: .9;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-muted);
}

.check input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent-strong);
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.actions.end {
  justify-content: flex-end;
}

.btn {
  min-height: 44px;
  padding: 9px 18px;
  color: #fff;
  background: var(--accent-strong);
  border: 1px solid var(--accent-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 5px 14px color-mix(in srgb, var(--accent-strong) 20%, transparent);
  font-weight: 700;
  cursor: pointer;
  text-transform: lowercase;
  transition: filter 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

:root[data-theme="dark"] .btn {
  color: #102027;
}

.btn:hover {
  filter: brightness(.94);
  transform: translateY(-1px);
}

.btn.secondary {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
  box-shadow: none;
  font-weight: 600;
}

.btn.secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn.danger {
  color: var(--danger);
  background: var(--surface);
  border-color: color-mix(in srgb, var(--danger) 42%, var(--border));
  box-shadow: none;
}

.btn.mini {
  min-height: 40px;
  padding: 6px 11px;
  font-size: 12px;
}

.session .btn.mini {
  min-height: 44px;
}

.btn:disabled {
  cursor: not-allowed;
  filter: none;
  opacity: .5;
  transform: none;
}

.person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.person:last-child {
  border-bottom: 0;
}

.person-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 600;
}

.person-name small {
  display: block;
  margin-top: 1px;
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.marks {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
}

.marks button {
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--text-subtle);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 140ms ease, color 140ms ease, background 140ms ease;
}

.marks button:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.marks button.on[data-value="P"] {
  color: #fff;
  background: var(--success);
  border-color: var(--success);
}

.marks button.on[data-value="F"] {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.marks button.on[data-value="J"] {
  color: var(--surface);
  background: var(--text);
  border-color: var(--text);
}

:root[data-theme="dark"] .marks button.on[data-value="P"],
:root[data-theme="dark"] .marks button.on[data-value="F"] {
  color: #11191b;
}

.badge {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 4px 9px;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
}

.badge.alert {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 32%, transparent);
}

.pending {
  color: var(--text-muted);
  font-size: 12px;
}

.datum {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.datum > span:first-child {
  padding-top: 3px;
  color: var(--text-subtle);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.datum > span:last-child {
  max-width: 72%;
  overflow-wrap: anywhere;
  text-align: right;
  font-weight: 600;
}

.bar {
  margin-bottom: 17px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 7px;
  font-size: 13.5px;
}

.track {
  height: 9px;
  overflow: hidden;
  background: var(--accent-soft);
  border-radius: 999px;
}

.fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  border-radius: inherit;
}

.columns {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 150px;
  margin-top: 14px;
}

.column {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  min-width: 0;
  height: 100%;
}

.column i {
  width: 100%;
  min-height: 4px;
  background: linear-gradient(var(--accent), var(--accent-strong));
  border-radius: 5px 5px 1px 1px;
}

.column small {
  color: var(--text-subtle);
  font-size: 9px;
}

.prayer {
  margin: 0 0 18px;
  padding: 3px 0 3px 15px;
  border-left: 3px solid var(--accent);
}

.prayer.answered {
  border-color: var(--success);
  opacity: .82;
}

.prayer p {
  margin: 0 0 7px;
  font-size: 14.5px;
}

.prayer p b {
  padding: 1px 4px;
  background: var(--accent-soft);
  border-radius: 4px;
}

.meta {
  color: var(--text-subtle);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.answer {
  color: var(--success);
  font-size: 12.5px;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  margin-inline: -4px;
  padding: 0 4px 4px;
  overscroll-behavior-inline: contain;
}

.swipe-hint {
  display: inline-block;
  color: var(--accent-strong);
  font-weight: 700;
}

.calendar-table.coordinator table {
  min-width: 900px;
}

.calendar-table.coordinator th:first-child,
.calendar-table.coordinator td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: 10px 0 16px -16px rgb(22 45 53 / 55%);
}

.calendar-table.coordinator th:last-child,
.calendar-table.coordinator td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: -10px 0 16px -16px rgb(22 45 53 / 55%);
}

.calendar-table.coordinator th:first-child,
.calendar-table.coordinator th:last-child {
  z-index: 3;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  padding: 10px 8px;
  color: var(--text-subtle);
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--accent-soft) 36%, transparent);
}

td.center,
th.center {
  text-align: center;
}

td.done {
  color: var(--success);
  font-weight: 700;
}

td.empty {
  color: var(--text-subtle);
}

table input,
table select {
  min-width: 108px;
  padding: 7px 9px;
}

.material {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.material:last-child {
  border-bottom: 0;
}

.material-info {
  flex: 1;
  min-width: 0;
}

.material a {
  color: var(--text);
  border-bottom: 2px solid var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.material small {
  display: block;
  color: var(--text-subtle);
}

.embed {
  margin-top: 11px;
  overflow: hidden;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.embed iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

.embed audio {
  display: block;
  width: 100%;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.section-heading .legend {
  margin-bottom: 16px;
}

.map-summary {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.map-summary span {
  display: flex;
  flex-direction: column;
  min-width: 92px;
  padding: 9px 12px;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  line-height: 1.25;
}

.map-summary b {
  color: var(--text);
  font-size: 20px;
  letter-spacing: -.03em;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(280px, .75fr);
  gap: 14px;
}

.map {
  position: relative;
  min-height: 570px;
  overflow: hidden;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  isolation: isolate;
}

.map-list {
  max-height: 570px;
  overflow-y: auto;
  padding: 8px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

.map-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 12px;
  color: var(--text-subtle);
  font-size: 11px;
}

.map-location {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 72px;
  padding: 10px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.map-location + .map-location {
  margin-top: 3px;
}

.map-location:hover,
.map-location.active {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.map-location:hover {
  transform: translateX(2px);
}

.map-location.active {
  border-color: color-mix(in srgb, var(--accent) 46%, var(--border));
}

.map-location-number {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fff;
  background: var(--accent-strong);
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
}

:root[data-theme="dark"] .map-location-number {
  color: #112126;
}

.map-location-copy {
  min-width: 0;
}

.map-location-copy b,
.map-location-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-location-copy b {
  font-size: 12.5px;
}

.map-location-copy small {
  margin-top: 3px;
  color: var(--text-subtle);
  font-size: 10.5px;
}

.map-location-total {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  text-align: right;
}

.map-location-total small {
  display: block;
  color: var(--text-subtle);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
}

.map-note {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 12px;
  color: var(--text-subtle);
  font-size: 11px;
}

.leaflet-container {
  background: var(--surface-subtle);
  font-family: var(--font);
}

.leaflet-tile-pane {
  filter: saturate(.55) contrast(.94) brightness(1.04);
  transition: filter 180ms ease;
}

:root[data-theme="dark"] .leaflet-tile-pane {
  filter: invert(.9) hue-rotate(180deg) saturate(.5) brightness(.7) contrast(1.05);
}

.leaflet-control-zoom {
  overflow: hidden;
  border: 1px solid var(--border) !important;
  border-radius: 11px !important;
  box-shadow: var(--shadow-sm) !important;
}

.leaflet-control-zoom a {
  width: 38px !important;
  height: 38px !important;
  color: var(--text) !important;
  background: var(--surface) !important;
  border-color: var(--border) !important;
  line-height: 38px !important;
}

.leaflet-control-zoom a:hover {
  background: var(--surface-hover) !important;
}

.leaflet-control-attribution {
  color: var(--text-subtle) !important;
  background: color-mix(in srgb, var(--surface) 88%, transparent) !important;
  font-size: 9px !important;
  backdrop-filter: blur(8px);
}

.leaflet-control-attribution a {
  color: var(--accent-strong) !important;
}

.pg-marker-wrap {
  background: transparent;
  border: 0;
}

.pg-marker {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  place-content: center;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  border: 3px solid var(--surface);
  border-radius: 16px 16px 16px 4px;
  box-shadow: 0 9px 24px rgb(9 35 44 / 28%);
  line-height: 1;
  text-align: center;
  transform: rotate(-45deg);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.pg-marker > * {
  transform: rotate(45deg);
}

.pg-marker b {
  font-size: 15px;
}

.pg-marker small {
  margin-top: 2px;
  font-size: 8px;
  font-weight: 700;
  opacity: .82;
}

.leaflet-marker-icon:hover .pg-marker,
.leaflet-marker-icon:focus .pg-marker {
  box-shadow: 0 12px 28px rgb(9 35 44 / 38%);
  transform: rotate(-45deg) translate(2px, -2px);
}

:root[data-theme="dark"] .pg-marker {
  color: #102027;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: var(--shadow-md);
}

.leaflet-popup-content-wrapper {
  border: 1px solid var(--border);
  border-radius: 14px;
}

.leaflet-popup-content {
  margin: 15px 16px;
}

.map-popup {
  display: grid;
  gap: 3px;
  color: var(--text);
  font: 13px/1.4 var(--font);
}

.map-popup > b {
  margin-top: 2px;
  font-size: 16px;
}

.map-popup > span:not(.eyebrow),
.map-popup > small {
  color: var(--text-muted);
}

.map-popup > div {
  display: flex;
  gap: 12px;
  margin-top: 9px;
}

.map-popup button,
.map-popup a {
  padding: 0;
  color: var(--accent-strong);
  background: none;
  border: 0;
  font: 700 11px/1.4 var(--font);
  cursor: pointer;
  text-decoration: none;
}

.empty {
  padding: 26px 0;
  color: var(--text-subtle);
  text-align: center;
}

.notice {
  padding: 13px 15px;
  color: var(--text);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.notice.alert {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 22%, transparent);
}

.footer {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 44px;
  padding-top: 20px;
  color: var(--text-subtle);
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.footer span {
  margin-left: auto;
}

.login {
  display: grid;
  min-height: 100vh;
  padding: 28px;
  place-items: center;
  background:
    radial-gradient(circle at 12% 8%, var(--accent-glow), transparent 28rem),
    linear-gradient(145deg, var(--bg) 60%, var(--accent-soft));
}

.login-card {
  width: min(480px, 100%);
  padding: clamp(26px, 5vw, 40px);
  background: color-mix(in srgb, var(--surface-raised) 96%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.login-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 38px;
}

.login-head .logo {
  width: 158px;
}

.login-card h1 {
  margin: 8px 0 0;
  font-size: clamp(38px, 9vw, 49px);
}

.login-card .legend {
  margin-top: 14px;
}

.login-card .btn[type="submit"] {
  min-width: 170px;
}

.error {
  margin: 13px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.dev-code {
  margin-top: 13px;
  padding: 11px;
  color: var(--text);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.splash {
  display: grid;
  min-height: 100vh;
  place-items: center;
  align-content: center;
  gap: 22px;
  color: var(--text-subtle);
}

.splash img {
  width: 160px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgb(7 16 20 / 55%);
  backdrop-filter: blur(4px);
  animation: fade-in 160ms ease-out;
}

.modal {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 31;
  width: min(560px, calc(100% - 28px));
  overflow-y: auto;
  padding: 34px;
  color: var(--text);
  background: var(--surface-raised);
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 54px rgb(0 0 0 / 18%);
  animation: drawer-in 220ms cubic-bezier(.2, .8, .2, 1);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 20px;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 25px;
  cursor: pointer;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 50;
  max-width: min(390px, calc(100% - 44px));
  padding: 12px 16px;
  color: var(--surface);
  background: var(--text);
  border: 1px solid color-mix(in srgb, var(--surface) 16%, transparent);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast.alert {
  color: #fff;
  background: #a92837;
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes drawer-in {
  from { transform: translateX(35px); }
}

@media (max-width: 1024px) {
  .wrap {
    width: min(100% - 40px, 1220px);
  }

  .score {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .score > div {
    flex: 0 0 auto;
    min-width: 125px;
  }

  .map-layout {
    grid-template-columns: minmax(0, 1.55fr) minmax(270px, .85fr);
  }
}

@media (max-width: 820px) {
  .topbar {
    min-height: 84px;
    padding: 19px 0;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-layout {
    grid-template-columns: 1fr;
  }

  .map,
  .map-list {
    min-height: 0;
  }

  .map {
    height: min(58vh, 560px);
  }

  .map-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 340px;
  }

  .map-list-head {
    grid-column: 1 / -1;
  }

  .row.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .wrap {
    width: min(100% - 28px, 1220px);
    padding-bottom: max(68px, env(safe-area-inset-bottom));
  }

  .topbar {
    gap: 12px;
  }

  .logo {
    width: 126px;
  }

  .session {
    gap: 8px;
  }

  .session b {
    max-width: 112px;
  }

  .theme-toggle {
    width: 44px;
    height: 44px;
  }

  h1 {
    margin-top: 38px;
    font-size: clamp(40px, 13vw, 58px);
  }

  .subtitle {
    margin-top: 14px;
    font-size: 14.5px;
  }

  .score {
    margin-top: 26px;
    border-radius: 13px;
  }

  .score > div {
    min-width: 108px;
    padding: 14px 16px;
  }

  .score b {
    font-size: 25px;
  }

  .nav-shell {
    margin: 15px -14px 22px;
    padding: 8px 14px;
    backdrop-filter: none;
  }

  .tabs {
    width: 100%;
    gap: 4px;
  }

  .tabs button {
    flex: 1 1 0;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    min-height: 58px;
    padding: 6px 3px;
    border-radius: 12px;
    font-size: 10px;
    line-height: 1.1;
  }

  .tabs .nav-more {
    margin-left: 0;
  }

  .nav-more .nav-label {
    display: none;
  }

  .nav-more .nav-label-mobile {
    display: block;
  }

  .nav-chevron {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 11px;
    height: 11px;
  }

  .nav-panel,
  .nav-panel.compact {
    position: fixed;
    top: max(76px, env(safe-area-inset-top));
    bottom: max(10px, env(safe-area-inset-bottom));
    right: 10px;
    width: calc(100vw - 20px);
    max-height: none;
    padding: 14px;
    background: var(--surface-raised);
    border-radius: 15px;
  }

  body.nav-menu-open {
    overflow: hidden;
  }

  body.nav-menu-open::before {
    position: fixed;
    inset: 0;
    z-index: 19;
    background: rgb(7 16 20 / 32%);
    content: "";
  }

  .nav-panel-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .nav-group {
    padding: 7px;
  }

  .nav-option {
    min-height: 62px;
  }

  .grid,
  .row,
  .row.three {
    grid-template-columns: 1fr;
  }

  .card {
    min-height: 0;
  }

  .block {
    padding: 19px;
    border-radius: 14px;
  }

  .block + .block {
    margin-top: 14px;
  }

  .actions.end {
    justify-content: flex-start;
  }

  .datum {
    flex-direction: column;
    gap: 4px;
  }

  .datum > span:last-child {
    max-width: none;
    text-align: left;
  }

  .bar-label {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .section-heading {
    flex-direction: column;
    gap: 4px;
  }

  .map-summary {
    width: 100%;
    margin-bottom: 10px;
  }

  .map-summary span {
    flex: 1;
  }

  .map {
    height: 470px;
  }

  .map-list {
    display: block;
    max-height: 360px;
  }

  .map-note {
    flex-direction: column;
    gap: 3px;
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer span {
    margin-left: 0;
  }

  .login {
    padding: 16px;
  }

  .login-card {
    padding: 26px 22px;
    border-radius: 18px;
  }

  .login-head {
    margin-bottom: 30px;
  }

  .login-head .logo {
    width: 138px;
  }

  .login-card .btn {
    width: 100%;
  }

  .modal {
    inset: 0;
    width: 100%;
    padding: 28px 20px max(32px, env(safe-area-inset-bottom));
    border-left: 0;
  }

  .toast {
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
    max-width: calc(100% - 28px);
  }
}

@media (max-width: 430px) {
  .session-copy {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .status-dot {
    margin-right: 1px;
  }

  .card-foot {
    gap: 7px;
    padding-inline: 17px;
  }

  .person:has(.marks) {
    flex-wrap: wrap;
  }

  .person:has(.marks) .marks {
    width: 100%;
    justify-content: flex-end;
  }

  .material {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
