:root {
  --bg: #f2f5f9;
  --panel: #ffffff;
  --ink: #1a2533;
  --muted: #637083;
  --line: #d7dee8;
  --brand: #0f5db8;
  --accent: #0e8f69;
  --warn: #cb7f00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #e6eef9 0%, var(--bg) 45%);
  color: var(--ink);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
}

.wrap {
  width: min(1080px, 92vw);
  margin: 0 auto;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.125rem;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 14px;
}

nav a:hover {
  color: var(--brand);
}

main {
  padding: 24px 0 48px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}

h1,
h2,
h3 {
  margin-top: 0;
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

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

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

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

input[type='checkbox'] {
  width: auto;
  padding: 0;
}

button {
  border: 0;
  border-radius: 9px;
  padding: 10px 12px;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
}

button.secondary {
  background: #fff;
  color: var(--brand);
  border: 1px solid #9cc0eb;
}

button.ghost {
  background: #f5f9ff;
  color: var(--brand);
  border: 1px solid #c5dcf8;
}

button.warn {
  background: #fff8ec;
  color: var(--warn);
  border: 1px solid #f0cf8d;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

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

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.badge.open {
  border-color: #afe8d8;
  color: var(--accent);
  background: #eefbf6;
}

.badge.closed {
  border-color: #f0cf8d;
  color: var(--warn);
  background: #fff8ec;
}

.badge.trust {
  font-weight: 600;
}

.badge.trust-lv1 {
  border-color: #cfd6df;
  color: #6f7a87;
  background: #f7f9fb;
}

.badge.trust-lv2 {
  border-color: #c2d8ff;
  color: #2f6bff;
  background: #eef4ff;
}

.badge.trust-lv3 {
  border-color: #b7e5d4;
  color: #178b63;
  background: #eefaf5;
}

.badge.trust-lv4 {
  border-color: #f1d59a;
  color: #b47800;
  background: #fff8ea;
}

.small {
  color: var(--muted);
  font-size: 0.92rem;
}

.auth-msg {
  margin: -4px 0 0;
  min-height: 16px;
}

.auth-msg.ok {
  color: var(--accent);
}

.auth-msg.error {
  color: #b4440f;
}

.auth-code-mask {
  -webkit-text-security: disc;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.toggle-row {
  display: flex;
  gap: 8px;
}

.toggle-row button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.map-panel {
  margin-top: 0;
  padding: 14px;
}

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

.map-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fcfeff;
}

.map-card h4 {
  margin: 0;
}

.applicant-list {
  margin-top: 12px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}

.applicant-list h4 {
  margin: 0 0 8px;
}

.applicant-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
  background: #fafcff;
}

.applicant-main {
  margin-bottom: 6px;
}

.match-card h3 {
  margin: 4px 0 2px;
}

.match-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.match-facts span {
  white-space: nowrap;
}

button.mini {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.hidden {
  display: none !important;
}

.host-wizard-head {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #f9fcff;
}

.host-stepper {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.host-step {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
}

.host-step.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.host-step-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.host-quick-types {
  margin-bottom: 4px;
}

.host-choice-group {
  margin-top: 4px;
}

.host-time-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.host-time-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.host-time-col .row {
  margin-top: 0;
  flex-wrap: nowrap;
  gap: 6px;
}

.host-time-input {
  width: 68px;
  max-width: 68px;
}

.host-time-range > .small {
  grid-column: 1 / -1;
  margin: 0;
}

.host-venue-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.host-venue-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.host-venue-option {
  text-align: left;
}

.host-choice-btn.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.city-picker {
  width: 100%;
}

.city-picker-toggle {
  width: 100%;
  text-align: left;
}

.city-picker-panel {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.city-option.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.host-inline-error {
  color: #b4440f;
  min-height: 18px;
  margin: 0;
}

.host-optional {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #fbfdff;
}

.host-optional summary {
  cursor: pointer;
  color: var(--muted);
  margin-bottom: 8px;
}

.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 26, 38, 0.56);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.admin-modal {
  width: min(760px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

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

.admin-modal-head h3 {
  margin: 0;
}

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

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.admin-modal-error {
  min-height: 18px;
  color: #b4440f;
}

.admin-modal-json {
  background: #f5f8fc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  overflow: auto;
}

textarea {
  min-height: 140px;
}

body.mobile-site {
  background: #f4f6fa;
}

body.mobile-site .wrap {
  width: 100%;
  max-width: 100%;
  padding: 0 12px;
}

body.mobile-site .topbar {
  z-index: 30;
}

body.mobile-site .topbar-inner {
  min-height: 56px;
}

body.mobile-site .brand {
  font-size: 1.05rem;
}

body.mobile-site nav a {
  margin-left: 8px;
  font-size: 0.85rem;
}

body.mobile-site main {
  padding: 10px 0 84px;
}

body.mobile-site .panel {
  border-radius: 12px;
  padding: 12px;
}

.mobile-list-panel {
  margin-bottom: 72px;
}

.mobile-list-panel .filters {
  display: block;
  grid-template-columns: none;
}

.mobile-list-panel .match-card .actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mobile-list-panel .match-card .actions a {
  display: block;
}

.mobile-list-panel .match-card .actions a button,
.mobile-list-panel .match-card .actions > button {
  width: 100%;
}

.mobile-filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 6px;
  scrollbar-width: none;
}

.mobile-filter-row::-webkit-scrollbar {
  display: none;
}

.mobile-chip {
  flex: 0 0 auto;
  border-radius: 999px;
  white-space: nowrap;
}

.mobile-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.mobile-tabbar a {
  text-decoration: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.75rem;
}

.mobile-tabbar a.active {
  color: var(--brand);
  border-color: #c5dcf8;
  background: #f5f9ff;
  font-weight: 600;
}

.mobile-picker-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 39, 0.42);
  z-index: 80;
  display: flex;
  align-items: flex-end;
}

.mobile-picker-sheet {
  width: 100%;
  max-height: 78vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 12px;
}

.mobile-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.mobile-picker-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mobile-picker-option.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.mobile-picker-custom {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

@media (max-width: 900px) {
  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

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

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

  .city-picker-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .match-card .card-top {
    gap: 6px;
  }

  .match-card .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .match-card .actions a {
    display: block;
  }

  .match-card .actions a button,
  .match-card .actions > button {
    width: 100%;
  }

  .match-facts {
    font-size: 0.88rem;
  }

  .admin-modal-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  body.mobile-site .match-card .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}
