/* R57 活动签到系统 v1 */
:root {
  --primary: #1565C0; --accent: #42A5F5; --bg: #F0F4FA; --bg-light: #E3F2FD;
  --card: #FFF; --text: #0D2137; --text-muted: #607D8B; --border: #BBDEFB;
  --shadow: 0 4px 24px rgba(0,0,0,.08); --ok: #059669; --warn: #DC2626;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif; background: var(--bg); color: var(--text); line-height: 1.65; padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
html.has-mobile-bar body { padding-bottom: calc(8.75rem + env(safe-area-inset-bottom)); }
img { max-width: 100%; display: block; }
button, a { font: inherit; }
a { color: inherit; text-decoration: none; }

.persona-bar { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; padding: .55rem 1rem; background: var(--card); border-bottom: 1px solid var(--border); }
.persona-btn { padding: .4rem .85rem; border-radius: 999px; border: 2px solid var(--border); background: var(--bg); cursor: pointer; font-weight: 600; font-size: .82rem; }
.persona-btn.active { border-color: var(--primary); background: var(--primary); color: #fff; }

.top-nav { position: sticky; top: 0; z-index: 200; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); }
body[data-appearance='dark'] .top-nav { background: rgba(15,20,28,.92); }
.top-nav.is-scrolled { border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
.top-nav__row { display: flex; align-items: center; gap: .75rem; padding: .55rem 1rem; }
.top-nav__brand { font-weight: 800; color: var(--primary); font-size: .88rem; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-nav__menu { margin-left: auto; border: 1px solid var(--border); background: var(--card); border-radius: 6px; padding: .35rem .55rem; cursor: pointer; }
.top-nav__links { display: none; width: 100%; flex-direction: column; gap: .2rem; padding: 0 1rem 1rem; }
.top-nav__links.is-open { display: flex; }
.top-nav__links a, .top-nav__admin { color: var(--text-muted); padding: .45rem .65rem; border-radius: 6px; font-size: .82rem; border: none; background: none; cursor: pointer; text-align: left; }
.top-nav__share { border: 1px dashed var(--border) !important; }
.top-nav__admin { color: var(--primary) !important; font-weight: 700; }
@media (min-width: 768px) {
  .top-nav__menu { display: none; }
  .top-nav__links { display: flex !important; flex-direction: row; width: auto; margin-left: auto; padding: 0; align-items: center; }
}

.theme-panel { position: fixed; right: 10px; top: 50%; transform: translateY(-50%); z-index: 180; display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--card); border-radius: 10px; border: 1px solid var(--border); box-shadow: var(--shadow); max-height: 280px; overflow-y: auto; }
.theme-appearance-btn, .theme-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); cursor: pointer; padding: 0; }
.theme-appearance-btn { background: var(--card); font-size: .72rem; line-height: 22px; text-align: center; }
.theme-dot.active { outline: 2px solid var(--text); }

.mobile-bar { position: fixed; left: 0; right: 0; bottom: calc(4.25rem + env(safe-area-inset-bottom)); z-index: 840; display: flex; background: var(--card); border-top: 1px solid var(--border); }
.mobile-bar__btn { flex: 1; padding: .55rem .2rem; border: none; background: none; font-size: .66rem; color: var(--text-muted); text-align: center; cursor: pointer; text-decoration: none; }
@media (min-width: 768px) { .mobile-bar { display: none; } html.has-mobile-bar body { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); } }

.contact-footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 850; padding: .45rem .75rem calc(.45rem + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--border); }
.contact-footer__btns { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; max-width: 420px; margin: 0 auto; }
.contact-footer__cta, .contact-footer__btn { padding: .4rem .85rem; border-radius: 999px; font-size: .74rem; font-weight: 600; }
.contact-footer__cta { background: var(--primary); color: #fff; border: 1px solid var(--primary); }
body[data-appearance='dark'] .contact-footer__cta { color: #111; }
.contact-footer__btn { background: var(--card); border: 1px solid var(--border); cursor: pointer; }
.contact-footer__brand { text-align: center; font-size: .62rem; color: var(--text-muted); margin-top: .35rem; }

.glass-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.section { padding: 2.5rem 1.25rem; max-width: 720px; margin: 0 auto; }
.section__title { font-size: 1.3rem; font-weight: 800; color: var(--primary); text-align: center; margin-bottom: .35rem; }
.section__sub { text-align: center; font-size: .82rem; color: var(--text-muted); margin-bottom: 1rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: .65rem 1.15rem; border-radius: 999px; font-weight: 600; font-size: .88rem; border: none; cursor: pointer; }
.btn-primary { background: var(--primary); color: #fff; }
body[data-appearance='dark'] .btn-primary { color: #111; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-sm { padding: .4rem .75rem; font-size: .78rem; }
.btn-block { display: block; width: 100%; margin-top: .5rem; text-align: center; }

.hero { position: relative; min-height: 360px; display: flex; align-items: flex-end; max-width: none; padding: 0; }
.hero__bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.hero__overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.88), rgba(0,0,0,.4)); }
.hero__content { position: relative; z-index: 1; color: #fff; padding: 2rem 1.25rem; max-width: 720px; margin: 0 auto; width: 100%; text-align: center; }
.hero__content h1 { font-size: 1.45rem; font-weight: 800; margin-bottom: .35rem; }
.hero__slogan { font-size: .9rem; opacity: .92; margin-bottom: .5rem; }
.hero__meta { font-size: .78rem; opacity: .85; margin-bottom: 1rem; line-height: 1.6; }

.checkin-rate { padding: .85rem 1rem; margin: 0 auto 1rem; max-width: 360px; text-align: left; color: var(--text); }
.checkin-rate__head { display: flex; justify-content: space-between; font-size: .82rem; margin-bottom: .35rem; }
.progress-bar { height: 8px; background: var(--bg-light); border-radius: 999px; overflow: hidden; }
.progress-bar__fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s; }
.progress-bar__fill--hot { background: var(--ok); }

.dashboard-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .65rem; margin-bottom: 1rem; }
@media (min-width: 640px) { .dashboard-grid { grid-template-columns: repeat(4, 1fr); } }
.dashboard-card { padding: 1rem; text-align: center; }
.dashboard-card__icon { font-size: 1.4rem; }
.dashboard-card__val { font-size: 1.3rem; font-weight: 800; color: var(--primary); margin: .2rem 0; }
.dashboard-card__lbl { font-size: .72rem; color: var(--text-muted); }

.checkin-form { padding: 1.25rem; max-width: 420px; margin: 0 auto; }
.form-field { margin-bottom: .75rem; }
.form-field label { display: block; font-size: .78rem; color: var(--text-muted); margin-bottom: .25rem; }
.form-field input { width: 100%; padding: .55rem .65rem; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: .88rem; }

.location-box { padding: .85rem; margin: .75rem 0; font-size: .82rem; }
.location-box--ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, var(--card)); }
.location-box--fail { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--card)); }
.location-box__status { font-weight: 700; margin-bottom: .25rem; }

.qr-panel { padding: 1.25rem; text-align: center; max-width: 320px; margin: 0 auto; }
.qr-panel canvas { margin: .75rem auto; border-radius: 8px; }
.qr-panel__url { font-size: .68rem; color: var(--text-muted); word-break: break-all; margin-top: .5rem; }

.chart-row { display: grid; gap: 1rem; }
@media (min-width: 640px) { .chart-row { grid-template-columns: 1fr 1fr; } }
.chart-box { padding: 1rem; min-height: 220px; }
.chart-box canvas { max-height: 180px; }

.list-table { width: 100%; border-collapse: collapse; font-size: .75rem; }
.list-table th, .list-table td { padding: .5rem .4rem; border-bottom: 1px solid var(--border); text-align: left; }
.list-table th { color: var(--text-muted); font-weight: 600; }
.list-search { width: 100%; max-width: 320px; margin: 0 auto 1rem; display: block; padding: .5rem .65rem; border-radius: 8px; border: 1px solid var(--border); background: var(--card); }

.badge { display: inline-block; font-size: .62rem; font-weight: 700; padding: .12rem .4rem; border-radius: 4px; }
.badge--ok { background: #DCFCE7; color: #166534; }
.badge--qr { background: #DBEAFE; color: #1E40AF; }
.badge--manual { background: #FEF3C7; color: #92400E; }

.modal { position: fixed; inset: 0; z-index: 910; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.modal__box { position: relative; max-width: 340px; width: 100%; padding: 1.5rem; text-align: center; }
.modal__close { position: absolute; top: .5rem; right: .5rem; border: none; background: none; font-size: 1.1rem; cursor: pointer; color: var(--text-muted); }
.stamp { font-size: 3rem; margin: .5rem 0; animation: stampPop .5s ease; }
@keyframes stampPop { from { transform: scale(2); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.checkin-toast { position: fixed; left: 50%; bottom: calc(6rem + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: rgba(15,23,42,.92); color: #fff; padding: .55rem 1rem; border-radius: 999px; font-size: .82rem; z-index: 920; opacity: 0; pointer-events: none; transition: .25s; }
.checkin-toast--show { opacity: 1; transform: translateX(-50%) translateY(0); }

.checkin-page { min-height: 100vh; padding: 1.5rem 1.25rem calc(6rem + env(safe-area-inset-bottom)); max-width: 420px; margin: 0 auto; }
.checkin-page__hero { text-align: center; margin-bottom: 1.25rem; }
.checkin-page__hero h1 { font-size: 1.2rem; color: var(--primary); margin-bottom: .35rem; }

.share-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.share-card { max-width: 360px; width: 100%; padding: 1.5rem; text-align: center; }
.share-card__stats { display: flex; justify-content: space-around; margin: 1rem 0; font-size: .78rem; color: var(--text-muted); }
.share-card__stats strong { display: block; font-size: 1.25rem; color: var(--primary); }

.admin-only[hidden] { display: none !important; }
