/* ==========================================================================
   管理後台與報到頁 · Dashboard & check-in
   ========================================================================== */
.hd-app { max-width: 1440px; margin: 0 auto; padding: 24px 16px 80px; }
@media (min-width: 768px) { .hd-app { padding: 32px 28px 80px; } }
.hd-banner { background: #fff7e6; border-bottom: 1px solid #f0dfb8; color: #7a5a16; font-size: 13px; line-height: 1.6; padding: 10px 20px; text-align: center; }
.hd-signin, .hd-empty-state { max-width: 480px; margin: 10vh auto; text-align: center; }

.hd-shell { display: grid; gap: 24px; }
@media (min-width: 1024px) { .hd-shell { grid-template-columns: 280px minmax(0, 1fr); align-items: start; } }
.hd-events { background: #fff; border: 1px solid var(--p-line); border-radius: 18px; padding: 16px; }
@media (min-width: 1024px) { .hd-events { position: sticky; top: 84px; } }
.hd-events__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.hd-events__list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
@media (min-width: 1024px) { .hd-events__list { flex-direction: column; overflow: visible; } }
.hd-event { text-align: left; border: 1px solid transparent; border-radius: 12px; background: var(--p-bg); padding: 10px 12px; cursor: pointer; min-width: 200px; display: grid; gap: 2px; }
.hd-event b { font-weight: 500; font-size: 14px; }
.hd-event small { color: var(--p-muted); font-size: 12px; }
.hd-event.is-active { border-color: var(--p-ink); background: #fff; }

.hd-main { min-width: 0; background: #fff; border: 1px solid var(--p-line); border-radius: 18px; padding: 20px; }
@media (min-width: 768px) { .hd-main { padding: 28px; } }
.hd-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: flex-start; }
.hd-head__actions { align-items: center; }
.hd-head__actions > .btn { flex: 0 0 auto; }
.hd-meta { font: 500 11px/1.4 var(--p-sans); letter-spacing: .2em; text-transform: uppercase; color: var(--p-gold); }
.hd-title { font: 500 clamp(26px, 4vw, 36px)/1.15 var(--p-display); margin-top: 4px; }
.hd-sub { color: var(--p-muted); font-size: 14px; margin-top: 4px; }
.hd-public { margin-top: 18px; }
.hd-public label { display: block; font-size: 12px; color: var(--p-muted); margin-bottom: 6px; letter-spacing: .06em; }
.hd-public__row { display: flex; gap: 8px; flex-wrap: wrap; }
.hd-public__row .ed-input { flex: 1 1 260px; font-size: 13px; }

.hd-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 22px 0; }
@media (min-width: 640px) { .hd-stats { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .hd-stats { grid-template-columns: repeat(6, 1fr); } }
.hd-stat { border: 1px solid var(--p-line); border-radius: 14px; padding: 14px; background: var(--p-bg); }
.hd-stat b { display: block; font: 500 30px/1 var(--p-display); }
.hd-stat span { font-size: 12px; color: var(--p-muted); }
.hd-stat--attending b { color: #2f7a52; }
.hd-stat--declined b { color: #a3443a; }
.hd-stat--checkedIn b { color: var(--p-gold); }

.hd-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--p-line); overflow-x: auto; }
.hd-tab { border: 0; background: none; padding: 12px 14px; font: 500 13px/1 var(--p-sans); letter-spacing: .06em; color: var(--p-muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.hd-tab[aria-selected='true'] { color: var(--p-ink); border-bottom-color: var(--p-ink); }
.hd-tabbody { padding-top: 18px; }

.hd-addform { display: grid; gap: 8px; grid-template-columns: 1fr; margin-bottom: 14px; }
@media (min-width: 900px) { .hd-addform { grid-template-columns: 2fr 1.5fr 90px 90px 1.4fr auto; } }
.hd-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.hd-search { flex: 1 1 220px; }
.hd-filter { flex: 0 0 auto; width: auto; }

.hd-tablewrap { overflow-x: auto; border: 1px solid var(--p-line); border-radius: 14px; }
.hd-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 820px; }
.hd-table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--p-muted); background: var(--p-bg); padding: 10px 12px; white-space: nowrap; }
.hd-table td { padding: 10px 12px; border-top: 1px solid var(--p-line); vertical-align: middle; }
.hd-table td small { display: block; color: var(--p-muted); font-size: 12px; }
.hd-table .hd-msg { font-style: italic; max-width: 260px; }
.hd-actions { white-space: nowrap; text-align: right; }
.hd-icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--p-line); background: #fff; color: var(--p-ink); cursor: pointer; vertical-align: middle; transition: background .2s, border-color .2s; }
.hd-icon-btn:hover { border-color: var(--p-ink); }
.hd-icon-btn:disabled { opacity: .5; cursor: progress; }
.hd-icon-btn svg { width: 17px; height: 17px; }
.hd-wa { color: #128c7e; }
.hd-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; background: #f1ede6; color: #6b625a; }
.hd-pill--yes { background: #e3f3ea; color: #2f7a52; }
.hd-pill--no { background: #f8e4e1; color: #a3443a; }
.hd-pill--maybe { background: #fdf1d8; color: #8a6414; }
.hd-pill--checked { background: #f3ead9; color: #7a5a24; }
.hd-empty, .hd-loading { color: var(--p-muted); padding: 30px 0; text-align: center; }
.hd-hint { color: var(--p-muted); font-size: 13px; line-height: 1.6; margin-bottom: 12px; }
.hd-cards { display: grid; gap: 10px; }
@media (min-width: 768px) { .hd-cards { grid-template-columns: repeat(2, 1fr); } }
.hd-card { border: 1px solid var(--p-line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 6px; }
.hd-card__meta { font-size: 12px; color: var(--p-muted); }
.hd-card__msg { font-size: 14px; white-space: pre-wrap; }

.hd-form { display: grid; gap: 14px; }
.hd-form label { display: grid; gap: 6px; font-size: 13px; color: var(--p-muted); }
.hd-form small { font-size: 12px; color: var(--p-muted); }
.hd-form textarea.ed-input { min-height: 90px; }
.hd-grid2 { display: grid; gap: 12px; }
@media (min-width: 560px) { .hd-grid2 { grid-template-columns: 1fr 1fr; } }
.hd-slug { display: flex; align-items: stretch; border: 1px solid var(--p-line); border-radius: 12px; overflow: hidden; background: #fff; }
.hd-slug:focus-within { border-color: var(--p-ink, #2a2622); }
.hd-slug__base { display: flex; align-items: center; padding: 0 10px; background: rgba(0,0,0,.04); color: var(--p-muted); font-size: 12px; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.hd-slug .ed-input { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; min-width: 0; flex: 1; }
.hd-fieldset { border: 1px dashed var(--p-line); border-radius: 14px; padding: 14px; display: grid; gap: 12px; }
.hd-fieldset legend { font-size: 13px; padding: 0 6px; }
.hd-narrow { min-width: 0; }
.hd-import { min-height: 220px !important; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

.hd-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; }
.hd-modal__backdrop { position: absolute; inset: 0; background: rgba(30, 26, 22, .5); backdrop-filter: blur(4px); }
.hd-modal__panel { position: relative; width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: #fff; border-radius: 20px; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .5); }
.hd-modal__panel.is-wide { width: min(760px, 100%); }
.hd-modal__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--p-line); position: sticky; top: 0; background: #fff; z-index: 1; }
.hd-modal__head h2 { font: 500 22px/1.2 var(--p-display); }
.hd-modal__body { padding: 20px; }
body.hd-modal-open { overflow: hidden; }
.hd-qr { display: grid; gap: 14px; text-align: center; }
.hd-qr__code { width: min(260px, 70vw); margin: 0 auto; }
.hd-qr__code svg { width: 100%; height: auto; display: block; }

/* ---------- 報到頁 ---------- */
.ck-app { max-width: 720px; margin: 0 auto; padding: 20px 16px 60px; }
.ck-head { text-align: center; margin-bottom: 18px; }
.ck-progress { margin-top: 10px; }
.ck-bar { height: 8px; border-radius: 999px; background: var(--p-line); overflow: hidden; margin-top: 8px; }
.ck-bar i { display: block; height: 100%; background: #2f7a52; border-radius: inherit; transition: width .4s; }
.ck-scan { background: #111; border-radius: 20px; overflow: hidden; position: relative; aspect-ratio: 1; max-height: 60vh; margin: 0 auto 14px; display: grid; place-items: center; color: #fff; }
.ck-scan video { width: 100%; height: 100%; object-fit: cover; }
.ck-scan__frame { position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 20px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); pointer-events: none; }
.ck-scan__idle { display: grid; gap: 14px; justify-items: center; padding: 24px; text-align: center; }
.ck-scan__idle svg { width: 64px; height: 64px; opacity: .8; }
.ck-search { margin-top: 18px; }
.ck-list { display: grid; gap: 8px; margin-top: 10px; }
.ck-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--p-line); border-radius: 14px; padding: 10px 14px; background: #fff; }
.ck-row b { display: block; font-weight: 500; }
.ck-row small { color: var(--p-muted); font-size: 12px; }
.ck-result { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 16px; background: rgba(20, 18, 16, .55); backdrop-filter: blur(4px); }
.ck-result__card { width: min(420px, 100%); background: #fff; border-radius: 24px; padding: 28px 24px; text-align: center; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .6); animation: ckIn .3s cubic-bezier(.2, .7, .2, 1); }
@keyframes ckIn { from { transform: scale(.94); opacity: 0; } }
.ck-result__icon { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 12px; font-size: 34px; color: #fff; }
.ck-result--ok .ck-result__icon { background: #2f7a52; }
.ck-result--already .ck-result__icon { background: #c98a1c; }
.ck-result--notfound .ck-result__icon, .ck-result--declined .ck-result__icon { background: #a3443a; }
.ck-result__name { font: 500 30px/1.2 var(--p-display); margin-top: 6px; }
.ck-result__meta { color: var(--p-muted); margin-top: 6px; }
.ck-result .btn-row { margin-top: 20px; }

/* ---------- 照片 ---------- */
.hd-photos { display: grid; gap: 28px; }
.hd-photos section { display: grid; gap: 12px; justify-items: start; }
.hd-photos__h { font-size: 15px; font-weight: 500; margin: 0; }
.hd-photos__h small { color: var(--p-muted); font-weight: 400; margin-left: 6px; }
.hd-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; width: 100%; }
.hd-photo-grid--cover { grid-template-columns: minmax(0, 180px); }
.hd-photo { position: relative; margin: 0; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, .04); }
.hd-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hd-photo--empty { display: grid; place-items: center; padding: 12px; text-align: center; font-size: 12px; color: var(--p-muted); border: 1px dashed var(--p-line); background: transparent; grid-column: 1 / -1; aspect-ratio: auto; min-height: 90px; }
.hd-photo-grid--cover .hd-photo--empty { aspect-ratio: 3 / 4; }
.hd-photo__del { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 999px; border: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .92); color: #b42318; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.hd-photo__del svg { width: 16px; height: 16px; }
.hd-file { cursor: pointer; }
.hd-file.is-busy { opacity: .5; pointer-events: none; }

/* ---------- 已發送標記 ---------- */
.hd-sent { display: block; margin-top: 6px; padding: 0; border: 0; background: none; font: inherit; font-size: 11.5px; color: var(--p-muted); cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; white-space: nowrap; }
.hd-sent.is-sent { color: #1a7f45; text-decoration: none; }
.hd-stat--sent b { color: #1a7f45; }
.hd-banner--offline { background: #fde8e4; color: #8a2a1c; border-color: #f2b8ad; }
.hd-reminded { display: block; margin-top: 2px; font-size: 11px; color: #a46a1f; white-space: nowrap; }
.hd-remind { color: #a46a1f; }
