:root {
  --bg-a: #f4fbf8;
  --bg-b: #e0f3ea;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: rgba(255, 255, 255, 0.95);
  --surface-soft: rgba(239, 250, 245, 0.85);
  --line: rgba(26, 116, 86, 0.2);
  --text: #163028;
  --text-soft: #3f6256;
  --primary: #169c71;
  --primary-strong: #0f7c5a;
  --secondary: #1f7bd8;
  --danger: #d93f59;
  --warning: #d08a00;
  --radius: 16px;
  --shadow: 0 14px 34px rgba(12, 56, 42, 0.15);
  --rail-bg: linear-gradient(180deg, rgba(7, 75, 53, 0.94), rgba(10, 56, 42, 0.97));
  --rail-text: #d7f6ea;
}

body[data-theme="wacker"] {
  --bg-a: #f5f8ff;
  --bg-b: #e6eeff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: rgba(255, 255, 255, 0.98);
  --surface-soft: rgba(239, 244, 255, 0.93);
  --line: rgba(38, 92, 168, 0.22);
  --text: #132746;
  --text-soft: #3d577f;
  --primary: #0f5bbd;
  --primary-strong: #0a4b9d;
  --secondary: #2f89f5;
  --danger: #d14367;
  --warning: #b47500;
  --shadow: 0 14px 34px rgba(25, 60, 126, 0.14);
  --rail-bg: linear-gradient(180deg, rgba(13, 52, 126, 0.96), rgba(15, 37, 88, 0.98));
  --rail-text: #deebff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Manrope, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 0% 0%, var(--bg-a), var(--bg-b) 42%, #dceee6 100%);
  min-height: 100vh;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 85% 10%, rgba(255, 255, 255, 0.45) 0, transparent 38%),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 70px,
      rgba(255, 255, 255, 0.17) 70px,
      rgba(255, 255, 255, 0.17) 71px
    ),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 70px,
      rgba(255, 255, 255, 0.16) 70px,
      rgba(255, 255, 255, 0.16) 71px
    );
  opacity: 0.65;
}

h1,
h2,
h3,
h4 {
  font-family: Sora, sans-serif;
  letter-spacing: 0.01em;
  margin: 0;
}

p {
  margin: 0;
}

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

.hidden {
  display: none !important;
}

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.62rem 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
  font-family: Manrope, sans-serif;
}

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

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #27bf92);
  color: #f6fffb;
}

body[data-theme="wacker"] .btn-primary {
  background: linear-gradient(135deg, var(--primary), #2f89f5);
  color: #f6fbff;
}

.btn-secondary {
  background: var(--surface-soft);
  color: var(--text);
  border-color: var(--line);
}

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border-color: var(--line);
}

.btn-danger {
  background: color-mix(in srgb, var(--danger) 14%, #ffffff);
  color: #8e1f33;
  border-color: color-mix(in srgb, var(--danger) 45%, #ffffff);
}

.alert {
  padding: 0.75rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.alert-error {
  background: rgba(217, 63, 89, 0.12);
  border: 1px solid rgba(217, 63, 89, 0.28);
  color: #8e1f33;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  width: min(430px, 96vw);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.auth-card.wide {
  width: min(580px, 96vw);
}

.auth-card h1 {
  font-size: 1.4rem;
}

.auth-brand {
  margin-bottom: 0.35rem;
}

.auth-logo {
  width: min(100%, 420px);
  height: auto;
  display: block;
  margin: 0 auto 0.2rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.auth-subtitle {
  margin: 0.35rem 0 1rem;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.auth-form {
  display: grid;
  gap: 0.55rem;
}

label {
  font-size: 0.85rem;
  color: var(--text-soft);
}

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

input,
select,
textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  padding: 0.55rem 0.7rem;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
}

.divider {
  margin: 0.95rem 0;
  text-align: center;
  position: relative;
  color: var(--text-soft);
}

.divider span {
  background: transparent;
  padding: 0 0.6rem;
}

.app-shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.left-rail {
  padding: 1.1rem 0.85rem;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--rail-bg);
  display: grid;
  gap: 0.55rem;
  grid-template-rows: auto 1fr auto auto;
}

.brand {
  font-family: Sora, sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--rail-text);
  margin: 0.1rem 0 0.8rem;
  padding: 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.brand-ball {
  font-size: 1.2rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.rail-nav {
  display: grid;
  gap: 0.42rem;
  align-content: start;
}

.rail-btn {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: color-mix(in srgb, var(--rail-text) 88%, #b8d8cb 12%);
  border-radius: 12px;
  padding: 0.56rem 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.menu-icon {
  width: 1.35rem;
  height: 1.35rem;
  display: inline-flex;
  border-radius: 10px;
  padding: 0.15rem;
  background: rgba(255, 255, 255, 0.14);
}

.menu-icon svg {
  width: 100%;
  height: 100%;
}

.rail-btn.active,
.rail-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
}

.rail-team-card {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.58rem;
  min-width: 0;
}

.rail-team-logo {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.18);
}

.rail-team-text {
  display: grid;
  line-height: 1.2;
  min-width: 0;
  width: 100%;
}

.rail-team-text strong {
  color: #ffffff;
  font-size: 0.9rem;
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
}

.rail-team-text small {
  color: color-mix(in srgb, var(--rail-text) 86%, #ffffff 14%);
  font-size: 0.76rem;
}

.rail-logout-form {
  display: grid;
}

.rail-logout-btn {
  width: 100%;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.mobile-logout-form {
  display: none;
}

.mobile-topbar {
  display: none !important;
}

.mobile-menu-toggle {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  padding: 0;
}

.mobile-menu-toggle span {
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  display: block;
}

.mobile-menu-backdrop {
  display: none !important;
}

.main-stage {
  padding: 0.95rem;
  display: grid;
  gap: 0.75rem;
}

.hero-card {
  position: relative;
  background: linear-gradient(110deg, color-mix(in srgb, var(--primary) 16%, #ffffff), var(--surface-strong));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.26rem 7.1rem 0.24rem 0.62rem;
  min-height: 106px;
  overflow: hidden;
}

.hero-card::after {
  content: "⚽";
  position: absolute;
  right: 0.72rem;
  top: 0.12rem;
  font-size: 2rem;
  opacity: 0.18;
}

.hero-card.compact h1 {
  font-size: 1.95rem;
  line-height: 1.04;
}

.hero-card.compact p {
  margin-top: 0.02rem;
  color: var(--text-soft);
  font-size: 1.08rem;
  line-height: 1.04;
}

.hero-accent {
  margin-top: 0.03rem;
  font-size: 0.92rem;
  line-height: 1.02;
  color: var(--primary-strong);
  font-weight: 700;
}

.hero-team-logo {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  transform: translateY(-50%);
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  box-shadow: var(--shadow);
}

.view {
  display: none;
  gap: 0.75rem;
}

.view.active {
  display: grid;
}

.section-head {
  display: grid;
  gap: 0.2rem;
}

.section-head p {
  color: var(--text-soft);
}

.tournaments-head {
  justify-items: start;
  text-align: left;
  gap: 0.12rem;
}

.tournaments-subtitle {
  margin-top: 0.06rem;
}

.tournament-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.tournament-overview-card p {
  font-size: 1rem;
}

.tournament-overview-card small {
  color: var(--text-soft);
}

.tournaments-list {
  align-content: start;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.mini-card,
.panel,
.calendar-wrap,
.attendance-card,
.chat-sidebar,
.chat-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.mini-card,
.panel,
.attendance-card,
.chat-sidebar,
.chat-panel {
  padding: 0.9rem;
}

.football-card {
  position: relative;
}

.football-card::after {
  content: "";
  position: absolute;
  right: 0.7rem;
  top: 0.7rem;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--primary) 58%, #ffffff);
  opacity: 0.5;
}

.mini-card p {
  margin-top: 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.overview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
}

.overview-head p {
  margin-top: 0.2rem;
  color: var(--text-soft);
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr);
  gap: 0.8rem;
}

.calendar-wrap {
  padding: 0.65rem;
  min-height: 620px;
}

.side-panel {
  display: grid;
  gap: 0.8rem;
}

.stack-form {
  display: grid;
  gap: 0.46rem;
}

.event-form-actions {
  justify-content: space-between;
}

.calendar-readonly-note {
  margin: 0;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px dashed var(--line);
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 0.88rem;
}

.weekday-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
}

.weekday-grid label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
}

.weekday-grid input {
  width: auto;
}

.attendance-actions {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.btn.attendance.yes {
  background: color-mix(in srgb, var(--primary) 14%, #ffffff);
  border-color: color-mix(in srgb, var(--primary) 40%, #ffffff);
  color: var(--primary-strong);
}

.btn.attendance.no {
  background: rgba(217, 63, 89, 0.12);
  border-color: rgba(217, 63, 89, 0.28);
  color: #8e1f33;
}

.btn.attendance.maybe {
  background: rgba(208, 138, 0, 0.13);
  border-color: rgba(208, 138, 0, 0.32);
  color: #7a5100;
}

.btn.attendance.is-active {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent);
  transform: translateY(-1px);
}

.btn.attendance.no.is-active {
  box-shadow: 0 0 0 2px rgba(217, 63, 89, 0.35);
}

.btn.attendance.maybe.is-active {
  box-shadow: 0 0 0 2px rgba(208, 138, 0, 0.35);
}

#attendance-lists {
  display: grid;
  gap: 0.68rem;
}

.attendance-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem;
  background: var(--surface-strong);
}

.attendance-group h4 {
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.carpool-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 0.9rem;
  display: grid;
  gap: 0.5rem;
}

.carpool-card h3 {
  margin: 0;
}

.carpool-card > p {
  color: var(--text-soft);
}

.carpool-offer {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
  padding: 0.6rem;
  display: grid;
  gap: 0.42rem;
}

.carpool-offer-head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: center;
}

.carpool-meta {
  color: var(--text-soft);
  font-size: 0.84rem;
}

.carpool-passenger-list {
  display: grid;
  gap: 0.32rem;
}

.carpool-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.28rem;
  font-size: 0.9rem;
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.avatar-large {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--line);
  background: var(--surface-soft);
  margin-bottom: 0.9rem;
}

.profile-identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.8rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

.profile-identity .avatar-large {
  margin-bottom: 0;
}

.profile-identity-body {
  display: grid;
  gap: 0.32rem;
  min-width: 0;
}

.profile-identity-body h3 {
  margin: 0;
}

.profile-identity-body small {
  color: var(--text-soft);
}

.profile-name-form {
  margin-top: 0.18rem;
}

.split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form input,
.inline-form select {
  min-width: 170px;
  flex: 1;
}

.list {
  display: grid;
  gap: 0.45rem;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem;
  background: var(--surface-strong);
}

.list-item-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
}

.member-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.list-item small {
  color: var(--text-soft);
}

.tournament-card {
  display: grid;
  gap: 0.55rem;
}

.tournament-meta-grid {
  display: grid;
  gap: 0.42rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tournament-meta {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.46rem 0.52rem;
  background: var(--surface-soft);
}

.tournament-meta strong {
  display: block;
  font-size: 0.77rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  margin-bottom: 0.12rem;
}

.tournament-plans {
  border-top: 1px dashed var(--line);
  padding-top: 0.52rem;
  display: grid;
  gap: 0.32rem;
}

.tournament-plan-link {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
}

.tournament-upload-form {
  margin-top: 0.45rem;
}

.tournament-empty {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 1rem;
  background: color-mix(in srgb, var(--primary) 8%, #ffffff);
  display: grid;
  gap: 0.42rem;
}

.tournament-empty h3 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tournament-empty small {
  color: var(--text-soft);
}

.list-item-actions {
  margin-top: 0.5rem;
  display: flex;
  justify-content: flex-end;
}

.btn-small {
  padding: 0.4rem 0.6rem;
  border-radius: 9px;
  font-size: 0.82rem;
}

.cash-edit-form {
  margin-top: 0.55rem;
  border-top: 1px dashed var(--line);
  padding-top: 0.55rem;
}

.cash-edit-grid {
  display: grid;
  gap: 0.42rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cash-edit-grid .full {
  grid-column: 1 / -1;
}

.team-logo {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  margin-bottom: 0.75rem;
}

.theme-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.theme-option {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
  padding: 0.55rem;
  display: grid;
  gap: 0.45rem;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.theme-option:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, #ffffff);
  transform: translateY(-1px);
}

.theme-option.active {
  border-color: color-mix(in srgb, var(--primary) 55%, #ffffff);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent);
}

.theme-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-option-head {
  display: grid;
  line-height: 1.2;
}

.theme-option-head small {
  color: var(--text-soft);
}

.theme-mini {
  height: 78px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--line) 80%, #ffffff);
  padding: 0.35rem;
  display: grid;
  grid-template-rows: 14px 1fr 12px;
  gap: 0.28rem;
}

.theme-mini-top,
.theme-mini-card,
.theme-mini-chip {
  display: block;
  border-radius: 8px;
}

.theme-mini-standard {
  background: linear-gradient(145deg, #eef9f4, #e3f3eb);
}

.theme-mini-standard .theme-mini-top {
  background: linear-gradient(120deg, #0f7c5a, #19a678);
}

.theme-mini-standard .theme-mini-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(26, 116, 86, 0.2);
}

.theme-mini-standard .theme-mini-chip {
  width: 42%;
  background: rgba(22, 156, 113, 0.22);
}

.theme-mini-wacker {
  background: linear-gradient(145deg, #edf3ff, #e3ecff);
}

.theme-mini-wacker .theme-mini-top {
  background: linear-gradient(120deg, #0f5bbd, #2f89f5);
}

.theme-mini-wacker .theme-mini-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(38, 92, 168, 0.24);
}

.theme-mini-wacker .theme-mini-chip {
  width: 42%;
  background: rgba(47, 137, 245, 0.25);
}

.invite-result {
  margin: 0.65rem 0;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.invite-link-row {
  margin-top: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.invite-delete-btn {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 42%, #ffffff);
  background: color-mix(in srgb, var(--danger) 8%, #ffffff);
  line-height: 1;
  min-width: 38px;
}

.invite-delete-btn:hover {
  border-color: color-mix(in srgb, var(--danger) 60%, #ffffff);
  background: color-mix(in srgb, var(--danger) 14%, #ffffff);
}

.chat-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 0.8rem;
  min-height: 540px;
}

.chat-sidebar {
  display: grid;
  gap: 0.55rem;
  align-content: start;
}

.chat-push-note {
  color: var(--text-soft);
  line-height: 1.3;
}

.chat-sidebar-head {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text);
  font-weight: 800;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 0.3rem 0.45rem;
}

.chat-room-btn {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  border-radius: 11px;
  padding: 0.52rem 0.62rem;
  cursor: pointer;
  font-weight: 600;
}

.chat-room-btn:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, #ffffff);
  background: color-mix(in srgb, var(--primary) 10%, #ffffff);
}

.chat-room-btn.active {
  border-color: color-mix(in srgb, var(--primary) 45%, #ffffff);
  background: color-mix(in srgb, var(--primary) 14%, #ffffff);
}

.chat-attach-wrap {
  position: relative;
}

.chat-attach-toggle {
  width: 42px;
  min-width: 42px;
  padding: 0.55rem 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
}

.chat-attach-menu {
  position: absolute;
  left: 0;
  bottom: 52px;
  min-width: 170px;
  display: grid;
  gap: 0.35rem;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.45rem;
  box-shadow: var(--shadow);
  z-index: 20;
}

.chat-media-image {
  width: min(250px, 100%);
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
}

.chat-media-audio {
  width: 100%;
  min-width: 220px;
}

.msg-body {
  display: grid;
  gap: 0.38rem;
}

.chat-title {
  font-family: Sora, sans-serif;
  margin-bottom: 0.65rem;
}

.chat-messages {
  min-height: 380px;
  max-height: 55vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem;
  background: var(--surface-strong);
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.msg {
  max-width: 78%;
  border-radius: 12px;
  padding: 0.5rem 0.62rem;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.msg.self {
  margin-left: auto;
  background: color-mix(in srgb, var(--primary) 12%, #ffffff);
  border-color: color-mix(in srgb, var(--primary) 30%, #ffffff);
}

.msg-head {
  font-size: 0.78rem;
  color: var(--text-soft);
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
  box-shadow: var(--shadow);
  z-index: 99;
}

.fc {
  --fc-border-color: var(--line);
  --fc-today-bg-color: color-mix(in srgb, var(--primary) 16%, #ffffff);
  --fc-button-bg-color: var(--surface-soft);
  --fc-button-border-color: var(--line);
  --fc-button-hover-bg-color: color-mix(in srgb, var(--primary) 15%, #ffffff);
  --fc-button-hover-border-color: color-mix(in srgb, var(--primary) 40%, #ffffff);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: transparent;
  --fc-neutral-text-color: var(--text-soft);
  color: var(--text);
}

.fc .fc-toolbar-title {
  font-family: Sora, sans-serif;
  font-size: 1.08rem;
}

.fc .fc-button {
  font-weight: 700;
  border-radius: 9px;
  color: var(--text);
}

.fc .fc-daygrid-day-number,
.fc .fc-col-header-cell-cushion {
  color: var(--text);
}

@media (max-width: 1180px) {
  .calendar-layout,
  .chat-layout,
  .split-grid,
  .cards-grid,
  .tournament-overview-grid {
    grid-template-columns: 1fr;
  }

  .calendar-wrap {
    min-height: 540px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .mobile-topbar {
    display: flex !important;
    align-items: center;
    gap: 0.55rem;
    position: sticky;
    top: 0;
    z-index: 55;
    padding: 0.62rem 0.72rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface-strong);
    backdrop-filter: blur(10px);
  }

  .mobile-topbar strong {
    font-family: Sora, sans-serif;
    color: var(--text);
  }

  .left-rail {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(84vw, 300px);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    z-index: 60;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: none;
    grid-template-rows: auto 1fr auto auto;
    overflow-y: auto;
    overflow-x: hidden;
    white-space: normal;
    padding: 0.9rem 0.75rem;
  }

  .app-shell.menu-open .left-rail {
    transform: translateX(0);
  }

  .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 28, 24, 0.45);
    z-index: 50;
  }

  .mobile-menu-backdrop.hidden {
    display: none !important;
    pointer-events: none;
  }

  .mobile-menu-backdrop:not(.hidden) {
    display: block !important;
    pointer-events: auto;
  }

  .rail-nav {
    display: grid;
    overflow: visible;
    white-space: normal;
  }

  .rail-btn {
    width: 100%;
    flex: none;
  }

  .brand {
    display: flex;
    margin: 0 0 0.35rem;
  }

  .rail-logout-form {
    display: grid !important;
    margin-top: 0.15rem;
  }

  .rail-team-card {
    width: 100%;
    padding: 0.5rem;
    gap: 0.48rem;
  }

  .rail-team-logo {
    width: 34px;
    height: 34px;
  }

  .rail-team-text strong {
    font-size: 0.84rem;
  }

  .rail-team-text small {
    font-size: 0.74rem;
  }

  .mobile-logout-form {
    display: none !important;
  }

  .main-stage {
    padding: 0.72rem;
  }

  .profile-identity {
    grid-template-columns: 1fr;
  }

  .attendance-actions {
    grid-template-columns: 1fr;
  }

  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-form input,
  .inline-form select {
    min-width: 0;
  }

  .cash-edit-grid {
    grid-template-columns: 1fr;
  }

  .tournament-meta-grid {
    grid-template-columns: 1fr;
  }

  .theme-picker {
    grid-template-columns: 1fr;
  }

  .chat-attach-menu {
    right: 0;
    left: auto;
  }

  .overview-head {
    align-items: center;
  }

  .hero-card {
    padding-right: 5.8rem;
    min-height: 84px;
  }

  .hero-team-logo {
    width: 72px;
    height: 72px;
  }
}

@media (min-width: 761px) {
  .app-shell {
    grid-template-columns: 230px minmax(0, 1fr) !important;
  }

  .mobile-topbar,
  .mobile-menu-backdrop {
    display: none !important;
  }

  .left-rail {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    bottom: auto !important;
    width: auto !important;
    transform: none !important;
    transition: none !important;
    z-index: auto !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-bottom: none !important;
    overflow: visible !important;
    padding: 1.1rem 0.85rem !important;
  }

  .rail-nav {
    display: grid !important;
    overflow: visible !important;
    white-space: normal !important;
  }

  .rail-btn {
    width: 100% !important;
    flex: none !important;
  }
}
