:root {
  --bg: #ffffff;
  --bg-right: #ffe2c2;
  --panel: #fff4e7;
  --surface: #fff0de;
  --surface-soft: #fff7ef;
  --line: #d5d4cf;
  --ink: #363636;
  --muted: #4b6a48;
  --accent: #4b6a48;
  --accent-strong: #3e583b;
  --accent-alt: #1f3d8f;
  --accent-warm: #ff6e00;
  --accent-hot: #f14924;
  --danger: #e52421;
  --danger-soft: #fff1f0;
  --badge-ring: #fcd12c;
  --shadow: rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(110deg, var(--bg) 0%, #fff8ef 52%, var(--bg-right) 100%);
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 24px;
  border-bottom: 1px solid rgba(54, 54, 54, 0.12);
  background: linear-gradient(110deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 110, 0, 0.14) 100%);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.serve-header-right {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.serve-page-title {
  text-align: right;
}

.serve-header-right #auth-area {
  text-align: right;
}

.serve-header-right .auth-actions {
  justify-content: flex-end;
}

.brand-logo {
  width: 160px;
  max-width: 38vw;
  height: auto;
  object-fit: contain;
}

h1 {
  margin: 0;
  font-size: 2rem;
  color: var(--accent-alt);
  letter-spacing: 0.01em;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
}

main {
  padding: 0 24px 24px;
}

.site-footer {
  margin: 6px 24px 20px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 244, 231, 0.72);
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
}

.site-footer p + p {
  margin-top: 4px;
}

.site-footer a {
  color: var(--accent-alt);
  font-weight: 700;
}

.panel {
  background: rgba(255, 244, 231, 0.94);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 32px var(--shadow);
}

.admin-hero {
  margin-bottom: 12px;
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.admin-kpi-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 250, 242, 0.95);
}

.admin-kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--accent-alt);
}

.admin-kpi-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin: 10px 0 12px;
}

.admin-filter-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.admin-filter-field textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 250, 242, 0.95);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px;
  font-size: 0.92rem;
}

.admin-table th {
  color: var(--accent-alt);
}

.admin-list {
  display: grid;
  gap: 8px;
}

.admin-list-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 250, 242, 0.95);
}

.admin-state {
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.82rem;
  padding: 4px 8px;
  height: fit-content;
  white-space: nowrap;
}

.admin-state.bad {
  border-color: var(--danger);
  color: var(--danger);
}

.health-status {
  margin-bottom: 12px;
}

.health-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.health-json {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 250, 242, 0.95);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
  overflow: auto;
}

.hero-intro {
  margin-bottom: 16px;
  background: linear-gradient(110deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 110, 0, 0.2) 100%);
  border-color: rgba(255, 110, 0, 0.35);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.hero-intro-content h2 {
  margin: 0 0 8px;
  color: var(--accent-alt);
}

.hero-intro-content {
  flex: 1;
  text-align: center;
}

.hero-intro-content p {
  margin: 0 auto;
  color: var(--ink);
  max-width: 900px;
  line-height: 1.45;
}

.hero-highlight {
  color: var(--accent-warm);
  font-weight: 800;
  letter-spacing: 0.03em;
}

.hero-service-highlight {
  color: var(--accent-alt);
  font-weight: 800;
}

.hero-intro-cta {
  white-space: nowrap;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.panel-header h2 {
  margin: 0;
}

.panel-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.refresh-note {
  color: var(--muted);
  font-size: 0.9rem;
}

button,
.button-link {
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

button:hover,
.button-link:hover {
  background: var(--accent-warm);
}

button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.message {
  min-height: 24px;
  margin-bottom: 8px;
  color: var(--muted);
}

.message.error {
  color: var(--danger);
}

.message.success {
  color: var(--accent);
}

.events {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 12px;
}

.event-pill {
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: 170px;
  min-height: 62px;
  border-radius: 12px;
  text-align: center;
}

.event-pill-name {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.1;
}

.event-pill-count {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.05;
  opacity: 0.98;
}

.selection-guide {
  margin: 6px 0 12px;
  border: 1px solid rgba(31, 61, 143, 0.25);
  border-radius: 12px;
  background: rgba(255, 250, 242, 0.95);
  padding: 10px 12px;
  text-align: center;
}

.selection-step {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent-alt);
}

.selection-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-alt);
}

.step-callout {
  margin-top: 8px;
  font-weight: 700;
  color: var(--accent-alt);
}

.event-pill.active {
  background: var(--accent-alt);
  border-color: var(--accent-alt);
}

.event-pill.secondary {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface-soft);
}

.event-summary {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--surface-soft);
}

.event-title {
  font-weight: 700;
  color: var(--accent-alt);
}

.slots {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.team-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.team-overview-card {
  width: 100%;
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 250, 242, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  padding: 14px;
  color: var(--ink);
  text-align: center;
}

.team-overview-card:hover {
  border-color: var(--accent-alt);
  box-shadow: 0 8px 20px rgba(31, 61, 143, 0.12);
}

.team-overview-badge {
  position: absolute;
  top: -14px;
  right: -10px;
  width: 84px;
  height: 84px;
  border-radius: 999px;
  background: var(--accent-alt);
  border: 3px solid var(--badge-ring);
  color: #fff;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 8px;
}

.team-overview-badge strong {
  display: block;
  font-size: 1.8rem;
  line-height: 1;
}

.team-overview-badge span {
  display: block;
  font-size: 0.72rem;
  line-height: 1.05;
  letter-spacing: 0.03em;
}

.team-overview-content {
  display: grid;
  gap: 6px;
}

.team-overview-name {
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--ink);
}

.team-overview-meta {
  color: var(--muted);
  font-size: 0.95rem;
}

.team-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.team-back-btn {
  font-size: 0.9rem;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 12px;
}

.team-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 248, 239, 0.94);
}

.team-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.team-card h3 {
  margin: 0;
  font-size: 1rem;
}

.meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.description-text {
  color: #2f2f2f;
  font-size: 0.9rem;
  line-height: 1.35;
  max-width: 680px;
}

.description-text strong {
  color: var(--accent-alt);
  font-weight: 800;
}

.stat {
  margin-bottom: 10px;
  font-weight: 700;
}

.position-list {
  display: grid;
  gap: 8px;
}

.position-row {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  padding-right: 98px;
}

.position-row.user-blocked {
  background: #f0eeea;
  border-color: #c7c4be;
}

.position-main {
  min-width: 0;
}

.position-title {
  font-weight: 600;
}

.position-team-meta {
  color: var(--accent-alt);
  font-size: 0.88rem;
  font-weight: 700;
  margin-top: 2px;
}

.position-service-meta {
  margin-top: 2px;
  font-size: 0.92rem;
  color: var(--ink);
}

.position-actions {
  margin-top: 10px;
}

.position-actions button {
  min-width: 122px;
}

.position-state-note {
  margin: 6px 0 4px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.position-count-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: var(--accent-alt);
  border: 3px solid var(--badge-ring);
  color: #fff;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 6px;
}

.position-count-badge strong {
  display: block;
  font-size: 1rem;
  line-height: 1.05;
}

.position-count-badge span {
  display: block;
  font-size: 0.58rem;
  line-height: 1;
  letter-spacing: 0.05em;
}

.error-row {
  border-color: #e8a7a6;
  background: var(--danger-soft);
}

.auth-name {
  margin-bottom: 8px;
  color: var(--muted);
  text-align: right;
}

.auth-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.sandwich-menu {
  position: relative;
}

.sandwich-menu > summary {
  list-style: none;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}

.sandwich-menu > summary::-webkit-details-marker {
  display: none;
}

.sandwich-menu[open] > summary {
  border-color: var(--accent-warm);
  background: rgba(255, 110, 0, 0.12);
}

.sandwich-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 24px var(--shadow);
  padding: 6px;
  display: grid;
  gap: 4px;
  z-index: 50;
}

.sandwich-link,
.sandwich-action {
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  padding: 8px 10px;
  text-align: left;
  text-decoration: none;
  font-weight: 600;
}

.sandwich-link:hover,
.sandwich-action:hover {
  background: rgba(255, 110, 0, 0.12);
  border-color: var(--accent-warm);
}

.sandwich-action {
  cursor: pointer;
}

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

.secondary:hover {
  background: rgba(255, 110, 0, 0.12);
  color: #000;
  border-color: var(--accent-warm);
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }

  .brand-wrap {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .serve-header-right {
    width: 100%;
    align-items: flex-end;
  }

  .serve-header-right .auth-actions {
    justify-content: flex-end;
  }

  .brand-logo {
    width: 140px;
    max-width: 60vw;
  }

  .panel-controls {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .hero-intro {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 10px;
  }

  .hero-intro-cta {
    width: 100%;
    text-align: center;
  }

  .hero-intro-content h2 {
    margin-bottom: 4px;
    font-size: 1.4rem;
  }

  .hero-intro-content p {
    font-size: 0.98rem;
    line-height: 1.35;
  }

  h1 {
    font-size: 1.55rem;
  }

  .subtitle {
    font-size: 0.92rem;
  }

  main {
    padding: 0 12px 14px;
  }

  .site-footer {
    margin: 4px 12px 14px;
    font-size: 0.86rem;
  }

  .panel {
    padding: 14px;
    border-radius: 12px;
  }

  .admin-list-item {
    flex-direction: column;
  }

  .panel-header {
    align-items: flex-start;
    gap: 8px;
  }

  .panel-header h2 {
    font-size: 1.6rem;
    line-height: 1;
  }

  .refresh-note {
    display: none;
  }

  #refresh-btn {
    padding: 8px 12px;
  }

  .events {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 8px;
    gap: 8px;
  }

  .event-summary {
    padding: 10px;
    margin-bottom: 10px;
    text-align: center;
  }

  .event-title {
    font-size: 1.05rem;
  }

  .event-pill {
    width: 100%;
    min-width: 0;
    min-height: 60px;
    gap: 2px;
  }

  .event-pill-name {
    font-size: 1.05rem;
  }

  .event-pill-count {
    font-size: 0.98rem;
  }

  .selection-guide {
    margin-bottom: 10px;
  }

  .selection-text {
    font-size: 1.02rem;
    line-height: 1.25;
  }

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

  .sandwich-menu-panel {
    right: auto;
    left: 0;
  }

  .team-overview-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .team-grid {
    grid-template-columns: 1fr;
  }

  .team-overview-card {
    min-height: 132px;
    padding: 12px;
  }

  .team-overview-name {
    font-size: 1.2rem;
  }

  .team-overview-badge {
    width: 68px;
    height: 68px;
    top: -10px;
    right: -8px;
    border-width: 2px;
  }

  .team-overview-badge strong {
    font-size: 1.45rem;
  }

  .team-overview-badge span {
    font-size: 0.64rem;
  }

  .team-detail-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .position-row {
    padding-right: 10px;
  }

  .position-actions {
    width: 100%;
    margin-top: 8px;
  }

  .position-count-badge {
    position: static;
    width: 64px;
    height: 64px;
    border-width: 2px;
    margin: 0 0 8px auto;
  }

  .position-count-badge strong {
    font-size: 0.9rem;
  }

  .position-count-badge span {
    font-size: 0.54rem;
  }

  .position-row button {
    width: 100%;
  }
}
