/* R58 活动报名系统（政企版）v1 */
:root {
  --primary: #B91C1C; --accent: #DC2626; --bg: #FEF2F2; --bg-light: #FEE2E2;
  --card: #FFF; --text: #450A0A; --text-muted: #991B1B; --border: #FECACA;
  --shadow: 0 4px 24px rgba(69,10,10,.08); --seal: #B91C1C;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'SimSun', 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)); }
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(26,5,5,.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: 36vw; 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-danger { background: #991B1B; color: #fff; }
.btn-sm { padding: .4rem .75rem; font-size: .78rem; }
.btn-block { display: block; width: 100%; margin-top: .5rem; text-align: center; }

.red-header-doc { background: var(--card); border: 2px solid var(--primary); padding: 1.25rem 1rem; margin-bottom: 1rem; text-align: center; position: relative; overflow: hidden; }
.red-header-doc::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--primary); }
.red-header-doc__issuer { font-size: .78rem; color: var(--primary); font-weight: 700; letter-spacing: .12em; }
.red-header-doc__title { font-size: 1.05rem; font-weight: 800; color: var(--text); margin: .65rem 0; line-height: 1.5; }
.red-header-doc__no { font-size: .75rem; color: var(--text-muted); }

.hero { position: relative; min-height: 280px; display: flex; align-items: flex-end; max-width: none; padding: 0; }
.hero__bg { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: .35; }
.hero__overlay { position: absolute; inset: 0; background: linear-gradient(to top, var(--bg), transparent); }
.hero__content { position: relative; z-index: 1; padding: 1.5rem 1.25rem 2rem; max-width: 720px; margin: 0 auto; width: 100%; }

.party-badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .72rem; font-weight: 700; padding: .25rem .65rem; border-radius: 4px; background: linear-gradient(135deg, #B91C1C, #DC2626); color: #fff; margin-bottom: .75rem; }

.step-indicator { display: flex; justify-content: center; gap: .5rem; margin-bottom: 1rem; }
.step-indicator__item { text-align: center; font-size: .68rem; color: var(--text-muted); opacity: .5; }
.step-indicator__item.active { opacity: 1; color: var(--primary); font-weight: 700; }
.step-indicator__item.done { opacity: .85; }
.step-indicator__item span { display: block; font-size: 1.2rem; }

.wizard { padding: 1.25rem; }
.form-field { margin-bottom: .75rem; }
.form-field label { display: block; font-size: .78rem; color: var(--text-muted); margin-bottom: .25rem; }
.form-field input, .form-field select { width: 100%; padding: .55rem .65rem; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: .88rem; }
.org-tree-select { font-family: inherit; }
.org-tree-select option { padding-left: .5rem; }

.bpmn-flow { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .35rem; padding: 1rem; overflow-x: auto; }
.bpmn-node { min-width: 72px; padding: .45rem .55rem; border-radius: 8px; border: 2px solid var(--border); background: var(--bg); text-align: center; font-size: .65rem; position: relative; }
.bpmn-node strong { display: block; font-size: .72rem; margin-bottom: .1rem; }
.bpmn-node--done { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--card)); color: var(--primary); }
.bpmn-node--active { border-color: var(--accent); background: var(--primary); color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); animation: bpmnPulse 1.5s infinite; }
.bpmn-node--reject { border-color: #991B1B; background: #FEE2E2; }
.bpmn-arrow { color: var(--text-muted); font-size: .85rem; }
@keyframes bpmnPulse { 0%,100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); } 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary) 10%, transparent); } }

.approval-card { padding: .85rem; margin-bottom: .5rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; }
.approval-card__info { flex: 1; min-width: 140px; font-size: .82rem; }
.approval-card__actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.approval-card input[type=checkbox] { margin-right: .35rem; }

.official-seal { width: 88px; height: 88px; border: 3px solid var(--seal); border-radius: 50%; color: var(--seal); display: flex; align-items: center; justify-content: center; font-size: .62rem; font-weight: 800; text-align: center; line-height: 1.2; margin: .75rem auto; transform: rotate(-12deg); animation: sealStamp .65s cubic-bezier(.34,1.56,.64,1); }
@keyframes sealStamp { from { transform: scale(2.5) rotate(-12deg); opacity: 0; } to { transform: scale(1) rotate(-12deg); opacity: 1; } }

.quota-bar { height: 8px; background: var(--bg-light); border-radius: 999px; overflow: hidden; margin: .5rem 0; }
.quota-bar__fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s; }

.dashboard-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .65rem; }
@media (min-width: 640px) { .dashboard-grid { grid-template-columns: repeat(4, 1fr); } }
.dashboard-card { padding: .85rem; text-align: center; }
.dashboard-card__icon { font-size: 1.25rem; display: block; margin-bottom: .25rem; }
.dashboard-card__val { font-size: 1.35rem; font-weight: 800; color: var(--primary); }
.dashboard-card__lbl { font-size: .68rem; color: var(--text-muted); margin-top: .15rem; }

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

.checkin-card { padding: 1.25rem; text-align: center; max-width: 360px; margin: 0 auto; }
.status-list { list-style: none; font-size: .82rem; }
.status-list li { padding: .55rem 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }

.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: 360px; width: 100%; padding: 1.25rem; max-height: 90vh; overflow-y: auto; }
.modal__box h3 { text-align: center; color: var(--primary); margin-bottom: 1rem; }

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

.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; }

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