/* 邀请有礼的三张页面：落地页 /invite、邀请中心 /invite/me、管理页 /invite/admin。基础变量、导航、按钮和分区沿用 home.css。 */
:root { --card: #ffffff; --amber-bg: #fff7e6; --amber-line: #f6dca8; --amber-ink: #7a4b00; }

/* .btn、.tag 这类组件自带 display，hidden 属性要压过它们。 */
[hidden] { display: none !important; }

/* ---------- 活动落地页 ---------- */
.iv-inviter {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; padding: 6px 14px; border-radius: 16px;
  background: var(--soft); color: var(--blue-dark); font-size: 14px; font-weight: 500;
}
.iv-note { margin-top: 14px; font-size: 14px; color: var(--muted); }

.iv-offer { padding: 24px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 1px 2px rgba(15, 28, 55, .05), 0 16px 40px -20px rgba(15, 28, 55, .2); }
.iv-gifts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.iv-gift { padding: 16px; border-radius: var(--radius); background: var(--surface); }
.iv-gift:first-child { background: var(--soft); }
.iv-gift small { display: block; color: var(--muted); font-size: 13px; }
.iv-gift strong { display: block; margin-top: 2px; color: var(--ink); font-size: 30px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
.iv-terms { margin: 16px 0 0; font-size: 14px; }
.iv-terms div { display: flex; justify-content: space-between; gap: 20px; padding: 10px 0; border-top: 1px solid var(--line); }
.iv-terms div:last-child { padding-bottom: 0; }
.iv-terms dt { flex: none; color: var(--muted); }
.iv-terms dd { margin: 0; color: var(--ink); text-align: right; }

.iv-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.iv-steps li::before { background: var(--white); }

.iv-rules { margin: 0; padding: 0; list-style: none; counter-reset: rule; border-top: 1px solid var(--line); }
.iv-rules li { counter-increment: rule; display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); color: var(--text); font-size: 15px; line-height: 1.75; }
.iv-rules li::before { content: counter(rule); flex: none; width: 20px; color: var(--blue-dark); font-weight: 600; font-variant-numeric: tabular-nums; }

.iv-foot { padding: 0 0 28px; }
.iv-foot .footer-bottom { margin-top: 0; }
.iv-foot .footer-bottom a { color: var(--muted); margin-left: 20px; }
.iv-foot .footer-bottom a:hover { color: var(--ink); }

/* ---------- 邀请中心和管理页 ---------- */
.iv-app { background: var(--surface); }
.iv-page { padding: 36px 0 72px; }
.iv-pagehead { display: flex; align-items: center; gap: 16px; }
.iv-mark { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--radius-lg); background: var(--blue); }
.iv-mark img { width: 34px; height: auto; }
.iv-pagehead-text { flex: 1; min-width: 0; }
.iv-pagehead h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 26px; line-height: 1.3; }
.iv-pagehead p { margin-top: 2px; color: var(--muted); font-size: 15px; }
.iv-pagehead-actions { display: flex; gap: 8px; flex: none; }

.iv-card { margin-top: 16px; padding: 24px; border-radius: var(--radius-lg); background: var(--card); border: 1px solid var(--line); }
.iv-card h2 { font-size: 17px; line-height: 1.4; }
.iv-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.iv-card > p, .iv-hint { margin-top: 4px; color: var(--muted); font-size: 14px; }

.iv-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.iv-stat { padding: 18px 20px; border-radius: var(--radius-lg); background: var(--card); border: 1px solid var(--line); }
.iv-stat strong { display: block; color: var(--ink); font-size: 26px; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.iv-stat small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.iv-stat.is-attention strong { color: #b76e00; }

.iv-linkcard { position: relative; overflow: hidden; margin-top: 24px; }
.iv-linkcard::after {
  content: ""; position: absolute; right: -44px; top: -46px; width: 300px; aspect-ratio: 204 / 140;
  background: url("/brand/dd-symbol-blue.svg") center / contain no-repeat; opacity: .05; pointer-events: none;
}
.iv-linkcard > * { position: relative; z-index: 1; }
.iv-link { display: flex; gap: 8px; margin-top: 16px; max-width: 720px; }
.iv-link input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: 500 14px var(--mono);
}
.iv-share { margin-top: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.iv-textlink { margin-left: 6px; color: var(--blue-dark); font-size: 14px; font-weight: 500; }
.iv-textlink:hover { text-decoration: underline; text-underline-offset: 3px; }

.iv-loading { margin-top: 24px; padding: 48px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.iv-center { text-align: center; padding: 48px 24px; }
.iv-center img { height: 26px; width: auto; margin: 0 auto 14px; }
.iv-center .iv-share { justify-content: center; margin-top: 18px; }

.iv-alert { margin-top: 16px; padding: 12px 16px; border-radius: var(--radius); background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--amber-ink); font-size: 14px; }
.iv-alert a { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.iv-alert.is-info { background: var(--soft); border-color: #c8dbff; color: var(--blue-dark); }

.iv-scroll { overflow-x: auto; }
.iv-table { width: 100%; margin-top: 12px; border-collapse: collapse; font-size: 14px; }
.iv-table th { padding: 10px 12px; background: var(--surface); text-align: left; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.iv-table th:first-child { border-radius: 6px 0 0 6px; }
.iv-table th:last-child { border-radius: 0 6px 6px 0; }
.iv-table td { padding: 12px; border-bottom: 1px solid var(--line); color: var(--text); vertical-align: top; font-variant-numeric: tabular-nums; }
.iv-table tr:last-child td { border-bottom: 0; }
.iv-empty { padding: 36px 16px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.iv-empty b { display: block; color: var(--ink); font-weight: 500; }

.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-style: normal; font-weight: 500; white-space: nowrap; letter-spacing: 0; }
.tag-gray { background: #eef1f6; color: #55647f; }
.tag-green { background: #e6f6ed; color: #0b7a47; }
.tag-amber { background: #fff1d6; color: #8a5a00; }
.tag-red { background: #fde9e7; color: #b42318; }
.tag-blue { background: var(--soft); color: var(--blue-dark); }

/* ---------- 管理页 ---------- */
.iv-admin-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.iv-admin-grid .iv-card { display: flex; flex-direction: column; }

.iv-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.iv-switch-row b { display: block; color: var(--ink); font-size: 15px; font-weight: 500; }
.iv-switch-row small { display: block; margin-top: 1px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.iv-switch { position: relative; flex: none; width: 40px; height: 22px; }
.iv-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.iv-switch i { display: block; height: 100%; border-radius: 11px; background: var(--line-strong); transition: background .15s; }
.iv-switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(15, 28, 55, .3); transition: transform .15s; }
.iv-switch input:checked + i { background: var(--blue); }
.iv-switch input:checked + i::after { transform: translateX(18px); }
.iv-switch input:focus-visible + i { outline: 2px solid var(--blue); outline-offset: 2px; }

.iv-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.iv-field label { display: block; margin-bottom: 6px; color: var(--ink); font-size: 14px; font-weight: 500; }
.iv-input { display: flex; align-items: center; height: 40px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.iv-input:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36, 107, 253, .12); }
.iv-input span { display: grid; place-items: center; width: 36px; height: 100%; background: var(--surface); border-right: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.iv-input input { flex: 1; min-width: 0; height: 100%; padding: 0 12px; border: 0; outline: 0; background: transparent; color: var(--ink); font: 500 15px var(--sans); }
.iv-field small { display: block; margin-top: 5px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }

.iv-preview { margin-top: 16px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: 14px; }
.iv-preview.is-invalid { background: #fde9e7; color: #b42318; }
.iv-save { display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 16px; }
.iv-save span { color: var(--muted); font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }

.iv-checks { margin: 10px 0 0; padding: 0; list-style: none; }
.iv-check { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.iv-check:last-child { border-bottom: 0; padding-bottom: 0; }
.iv-check-icon { flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1; }
.iv-check-icon svg { width: 13px; height: 13px; }
.iv-check.is-ok .iv-check-icon { background: #e6f6ed; color: #0b7a47; }
.iv-check.is-warn .iv-check-icon { background: #fff1d6; color: #8a5a00; }
.iv-check b { display: block; color: var(--ink); font-size: 14px; font-weight: 500; }
.iv-check small { display: block; margin-top: 1px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.iv-check-body { flex: 1; min-width: 0; }
.iv-check-action { flex: none; align-self: center; }

.iv-filters { display: flex; gap: 4px; margin-top: 14px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.iv-filters::-webkit-scrollbar { display: none; }
.iv-filter {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--muted); font: 500 14px/1.4 var(--sans); cursor: pointer; transition: color .15s;
}
.iv-filter:hover { color: var(--ink); }
.iv-filter[aria-selected="true"] { color: var(--blue-dark); border-bottom-color: var(--blue); font-weight: 600; }
.iv-filter em { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--surface); color: var(--muted); font-size: 12px; font-style: normal; font-weight: 500; text-align: center; }

.iv-table-admin td:nth-child(1), .iv-table-admin td:nth-child(2), .iv-table-admin td:nth-child(5), .iv-table-admin td:nth-child(7) { white-space: nowrap; }
.iv-table-admin td:nth-child(6) { min-width: 150px; }
.iv-mini { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 6px; }
.iv-muted { color: var(--faint); font-size: 12.5px; }
.iv-toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 100; transform: translateX(-50%);
  padding: 10px 16px; border-radius: var(--radius); background: #0f1c37; color: #fff; font-size: 14px;
  box-shadow: 0 10px 30px -10px rgba(11, 22, 48, .5);
}

/* 在控制台的自定义菜单里以 iframe 打开时，去掉站点导航和多余留白。 */
.is-embedded .nav { display: none; }
.is-embedded .iv-page { padding: 12px 0 24px; }
.is-embedded .wrap { width: calc(100% - 32px); max-width: 1160px; }

@media (max-width: 1080px) {
  .iv-admin-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .iv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .iv-steps { grid-template-columns: minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 680px) {
  .iv-page { padding-top: 24px; }
  .iv-pagehead { flex-wrap: wrap; }
  .iv-pagehead-text { flex-basis: calc(100% - 68px); }
  .iv-pagehead-actions { width: 100%; }
  .iv-pagehead-actions .btn { flex: 1; }
  .iv-card { padding: 18px; }
  .iv-form { grid-template-columns: minmax(0, 1fr); }
  .iv-link { flex-direction: column; }
  .iv-link input { flex: none; }
}

/* 控制台深色模式下嵌入时跟着变深。 */
.is-dark {
  --white: #0f1420; --card: #161d2c; --surface: #0f1420; --ink: #eef2fb; --text: #c9d3e6; --muted: #93a1bb; --faint: #6f7c95;
  --line: #243049; --line-strong: #2e3b57; --soft: #17284a; --blue-dark: #9dbcff;
  --amber-bg: #2b2210; --amber-line: #5c4614; --amber-ink: #ffd27a;
}
.is-dark body { background: var(--surface); }
.is-dark .iv-alert.is-info { border-color: #2a4a8a; }
.is-dark .iv-table th, .is-dark .iv-link input, .is-dark .iv-input span, .is-dark .iv-preview, .is-dark .iv-filter em { background: #1d2638; }
.is-dark .iv-preview.is-invalid { background: #3a1714; color: #ff8a80; }
.is-dark .tag-gray { background: #222c40; color: #a8b4cc; }
.is-dark .tag-green, .is-dark .iv-check.is-ok .iv-check-icon { background: #0f2e22; color: #5fd69b; }
.is-dark .tag-amber, .is-dark .iv-check.is-warn .iv-check-icon { background: #33270d; color: #ffcb66; }
.is-dark .tag-red { background: #3a1714; color: #ff8a80; }
.is-dark .iv-check-icon { background: #1d2638; }
.is-dark .iv-stat.is-attention strong { color: #ffcb66; }
.is-dark .iv-center img, .is-dark .iv-linkcard::after { filter: brightness(1.4); }
