:root {
  --bg: #f1f3f7;
  --card: #ffffff;
  --ink: #111a2e;
  --ink-2: #4a5568;
  --ink-3: #8590a4;
  --line: #e6e9f0;
  --brand: #2b58e6;
  --brand-soft: #eef2ff;
  --green: #157f4a;
  --green-soft: #e6f6ee;
  --red: #c0392b;
  --red-soft: #fdeeec;
  --amber: #94620f;
  --amber-soft: #fdf3e0;
  --hdr: calc(env(safe-area-inset-top, 0px) + 104px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}

button { font-family: inherit; }

/* ── 상단 고정 영역 ─────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding: env(safe-area-inset-top, 0px) 14px 0;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 46px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--ink);
}

.brand .logo {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: linear-gradient(160deg, #3a68ff, #1c3ab2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.brand .count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 2px 7px;
  letter-spacing: 0;
}

.tabs {
  display: flex;
  gap: 3px;
  background: #edf0f5;
  border-radius: 12px;
  padding: 3px;
  margin-bottom: 8px;
}

.tabs button {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 8px 2px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  color: #5a6478;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabs button.on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(16, 30, 54, 0.16);
}

.search-row { padding-bottom: 9px; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg { position: absolute; left: 11px; width: 15px; height: 15px; opacity: 0.45; }

.search-box input {
  width: 100%;
  border: 1px solid var(--line);
  background: #f5f7fa;
  border-radius: 11px;
  padding: 10px 34px 10px 33px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  appearance: none;
}

.search-box input:focus { border-color: #b9c7f7; background: #fff; }

.search-box .clear {
  position: absolute;
  right: 6px;
  border: 0;
  background: #dfe4ee;
  color: #5a6478;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
}

/* ── 본문 공통 ─────────────────────────────────── */
main { padding: 10px 14px 0; }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 14px 2px 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-3);
}

.section-title b { color: var(--ink); font-size: 13.5px; }

.empty {
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
  padding: 38px 16px;
  line-height: 1.6;
}

/* ── 필터 ──────────────────────────────────────── */
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

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

.select-wrap { position: relative; }

.select-wrap::after {
  content: "";
  position: absolute;
  right: 11px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.6px solid #8b95a7;
  border-bottom: 1.6px solid #8b95a7;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.select-wrap select {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 26px 8px 10px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink-2);
  outline: none;
}

.toggles { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
}

.toggle.on { border-color: #c9d5f9; background: var(--brand-soft); color: var(--brand); }

.toggle .dot {
  width: 13px;
  height: 13px;
  border-radius: 4px;
  border: 1.5px solid currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  line-height: 1;
}

.toggle .dot::after { content: ""; }

.toggle.on .dot { background: currentColor; border-color: currentColor; }

.toggle.on .dot::after { content: "✓"; font-size: 9px; font-weight: 900; line-height: 1; color: #fff; }

.alert {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  background: #fff8f1;
  border: 1px solid #f6ddbe;
  border-radius: 13px;
  padding: 11px 12px;
  margin-bottom: 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #7a4a12;
}

.alert b { color: #a4410a; }

.alert .links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.alert .links a {
  text-decoration: none;
  font-size: 11.5px;
  font-weight: 700;
  color: #8a4b10;
  background: #fff;
  border: 1px solid #f0dcc3;
  border-radius: 7px;
  padding: 4px 7px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 캠페인 카드 ───────────────────────────────── */
.card {
  background: var(--card);
  border-radius: 14px;
  padding: 12px 13px 11px;
  margin-bottom: 9px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.05);
  border: 1px solid rgba(230, 233, 240, 0.9);
}

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

.site-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
  background: #f1f3f8;
  border-radius: 6px;
  padding: 2.5px 6px;
  white-space: nowrap;
}

.amount {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--ink);
  white-space: nowrap;
}

.amount small { font-size: 11px; font-weight: 700; color: var(--ink-3); margin-left: 2px; }

.card h3 {
  margin: 6px 0 7px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 7px; }

.badge {
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 5px;
  padding: 2px 5px;
  letter-spacing: -0.1px;
}

.badge.free { background: var(--green-soft); color: var(--green); }
.badge.full { background: var(--brand-soft); color: #2f4bd8; }
.badge.partial { background: var(--red-soft); color: var(--red); }
.badge.visit { background: var(--amber-soft); color: var(--amber); }
.badge.type { background: #f1f3f8; color: var(--ink-2); }
.badge.warn { background: #fff4e5; color: #a55b00; }

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 9px;
  font-size: 11.5px;
  color: var(--ink-3);
  font-weight: 600;
}

.meta-line .dd { color: var(--ink-2); }

.dd.urgent { color: var(--red); font-weight: 800; }

.card-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid #f1f3f8;
}

.btn-pick {
  flex: 1;
  border: 1px solid #d8deea;
  background: #fff;
  color: var(--ink-2);
  border-radius: 9px;
  padding: 7px 0;
  font-size: 12.5px;
  font-weight: 700;
}

.btn-pick.on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-link {
  flex: 1.2;
  text-align: center;
  text-decoration: none;
  border: 1px solid #d8deea;
  background: #fff;
  color: var(--ink-2);
  border-radius: 9px;
  padding: 7px 0;
  font-size: 12.5px;
  font-weight: 700;
}

.btn-more {
  width: 100%;
  border: 1px solid #d8deea;
  background: #fff;
  color: var(--ink-2);
  border-radius: 11px;
  padding: 12px 0;
  font-size: 13px;
  font-weight: 700;
  margin: 4px 0 10px;
}

/* ── 하단 선택 바 ──────────────────────────────── */
.selbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  display: none;
  align-items: center;
  gap: 9px;
  padding: 9px 13px calc(9px + env(safe-area-inset-bottom, 0px));
  background: rgba(15, 23, 42, 0.97);
  backdrop-filter: blur(8px);
  color: #fff;
}

.selbar.show { display: flex; }
body.has-sel { padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }

.selbar .count { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.selbar .count b { font-size: 16px; color: #a8bcff; }

.selbar button {
  flex: 1;
  border: 0;
  border-radius: 10px;
  padding: 10px 6px;
  font-size: 13px;
  font-weight: 800;
  background: #fff;
  color: #101828;
  white-space: nowrap;
}

.selbar button.ghost { background: rgba(255, 255, 255, 0.14); color: #fff; flex: 0 0 auto; padding: 10px 12px; }

/* ── 바텀 시트 ─────────────────────────────────── */
.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}

.sheet-wrap.open { display: block; }

.sheet-back {
  position: absolute;
  inset: 0;
  background: rgba(12, 18, 32, 0.42);
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 8px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  animation: up 0.22s ease-out;
}

@keyframes up { from { transform: translateY(14px); opacity: 0.6; } to { transform: none; opacity: 1; } }

.sheet .grab {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: #dbe0ea;
  margin: 4px auto 10px;
}

.sheet h2 { margin: 0 0 2px; font-size: 16px; font-weight: 800; letter-spacing: -0.3px; }

.sheet .sub { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-bottom: 10px; }

.sheet-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
  max-height: 44vh;
}

.sheet-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  border-bottom: 1px solid #f2f4f8;
}

.sheet-item .idx {
  flex: 0 0 20px;
  font-size: 11px;
  font-weight: 800;
  color: var(--brand);
}

.sheet-item .txt { flex: 1; min-width: 0; }
.sheet-item .txt strong { display: block; font-size: 13px; font-weight: 700; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-item .txt span { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }

.sheet-item .rm {
  flex: 0 0 auto;
  border: 0;
  background: #f1f3f8;
  color: #5a6478;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
}

.sheet-actions { display: flex; gap: 8px; margin-top: 12px; }

.sheet-actions button {
  flex: 1;
  border: 0;
  border-radius: 12px;
  padding: 13px 8px;
  font-size: 14px;
  font-weight: 800;
}

.primary { background: var(--brand); color: #fff; }
.secondary { background: #f1f3f8; color: var(--ink-2); }

/* ── 내 체험단 관리 ────────────────────────────── */
.summary {
  border-radius: 16px;
  padding: 14px 15px 12px;
  background: linear-gradient(150deg, #1d2f5c 0%, #16233f 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(19, 34, 66, 0.22);
}

.summary .top { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; color: #b9c6e2; }

.summary .top .live { display: inline-flex; align-items: center; gap: 5px; }
.summary .top .live i { width: 6px; height: 6px; border-radius: 50%; background: #6ee7b7; display: inline-block; }

.summary .grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 8px;
  margin-top: 11px;
}

.summary .cell .k { font-size: 11px; color: #9fb0d2; font-weight: 600; }
.summary .cell .v { font-size: 19px; font-weight: 800; letter-spacing: -0.5px; margin-top: 2px; }
.summary .cell .v small { font-size: 11.5px; font-weight: 700; color: #c7d3ea; margin-left: 3px; }

.summary .note {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11.5px;
  color: #b9c6e2;
  line-height: 1.5;
}

.summary .note b { color: #ffd9a0; font-weight: 800; }

.st-filters {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 12px 0 8px;
  scrollbar-width: none;
}
.st-filters::-webkit-scrollbar { display: none; }

.pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}

.pill.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill span { opacity: 0.6; font-weight: 700; margin-left: 3px; }

.my-card {
  background: #fff;
  border-radius: 14px;
  padding: 12px 13px;
  margin-bottom: 9px;
  border: 1px solid rgba(230, 233, 240, 0.9);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.05);
}

.my-card.lost { opacity: 0.62; }

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

.status {
  font-size: 10.5px;
  font-weight: 800;
  border-radius: 6px;
  padding: 3px 7px;
  white-space: nowrap;
}

.status.applied { background: #eaf0ff; color: #2a4bd0; }
.status.won { background: #e6f6ee; color: #127a45; }
.status.bought { background: #f1e9ff; color: #6b34c9; }
.status.reviewed { background: #e8f4f8; color: #14657f; }
.status.lost { background: #f1f3f8; color: #7b8496; }

.my-card h4 {
  margin: 7px 0 6px;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.2px;
}

.my-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  font-size: 11.5px;
  color: var(--ink-3);
  font-weight: 600;
}

.my-dates b { color: var(--ink-2); font-weight: 700; }
.my-dates .urgent { color: var(--red); }

.memo {
  margin-top: 7px;
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.45;
  background: #f8f9fc;
  border-radius: 8px;
  padding: 7px 9px;
}

.st-actions { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }

.st-btn {
  border: 1px solid #d8deea;
  background: #fff;
  color: var(--ink-2);
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.st-btn.go { background: var(--brand); border-color: var(--brand); color: #fff; }
.st-btn.no { background: #fff; border-color: #f0c8c3; color: var(--red); }
.st-btn.link { margin-left: auto; text-decoration: none; }

/* ── 일정 ──────────────────────────────────────── */
.ev-card {
  display: flex;
  gap: 11px;
  background: #fff;
  border-radius: 14px;
  padding: 11px 13px;
  margin-bottom: 8px;
  border: 1px solid rgba(230, 233, 240, 0.9);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.05);
}

.ev-card.soon { border-color: #ffd0c8; background: #fffaf9; }
.ev-card.past { opacity: 0.55; }

.ev-date {
  flex: 0 0 46px;
  text-align: center;
  border-right: 1px solid #eef1f6;
  padding-right: 9px;
}

.ev-date .m { font-size: 10.5px; font-weight: 700; color: var(--ink-3); }
.ev-date .d { font-size: 19px; font-weight: 800; line-height: 1.1; letter-spacing: -0.6px; }
.ev-date .w { font-size: 10px; color: var(--ink-3); font-weight: 600; }

.ev-body { flex: 1; min-width: 0; }
.ev-body .kindline { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; flex-wrap: wrap; }

.kind {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2.5px 6px;
  border-radius: 5px;
  background: #eef2ff;
  color: #2f4bd8;
}

.kind.purchase { background: #fdf3e0; color: #94620f; }
.kind.review { background: #e6f6ee; color: #157f4a; }

.ev-body strong {
  display: -webkit-box;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: keep-all;
}

.ev-body .site { font-size: 11px; color: var(--ink-3); font-weight: 600; }

.ev-dday { font-size: 11px; font-weight: 800; color: var(--ink-2); }
.ev-dday.today { color: #c0392b; }
.ev-dday.d1 { color: #d35400; }

.ics-btn {
  flex: 0 0 auto;
  align-self: center;
  border: 1px solid #d8deea;
  background: #fff;
  color: var(--ink-2);
  border-radius: 9px;
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* ── 토스트 ────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 12px);
  background: rgba(17, 26, 46, 0.94);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  padding: 10px 15px;
  border-radius: 11px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 80;
  max-width: calc(100vw - 40px);
  text-align: center;
  line-height: 1.4;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

.hidden { display: none !important; }

.foot-note {
  margin: 12px 4px 20px;
  font-size: 11px;
  line-height: 1.65;
  color: var(--ink-3);
  text-align: center;
  font-weight: 600;
}
