* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  /* AlphaTrace 品牌：海军蓝 #0C4676 + 亮蓝 #116DFF + 橙 #F17B20 */
  --brand: #0c4676; --brand-600: #0a3a63; --brand-300: #7fa8cf;
  --primary: #116dff; --primary-dark: #0c56cc; --accent: #f17b20;
  --ink: #1d233e; --text: #232a3d; --muted: #6b7488;
  --line: #e4e9f2; --card: #ffffff;
  --bg: radial-gradient(1200px 600px at 12% -8%, #eaf2fb 0%, rgba(234,242,251,0) 55%),
        radial-gradient(1000px 520px at 100% 0%, #f3ede4 0%, rgba(243,237,228,0) 45%), #f6f8fb;
  --danger: #d63a3a; --ok: #14915f; --warn: #d98706;
  --shadow-sm: 0 1px 2px rgba(16,40,80,.06), 0 2px 8px rgba(16,40,80,.05);
  --shadow: 0 8px 30px rgba(12,70,118,.10), 0 2px 8px rgba(12,70,118,.06);
  --shadow-lg: 0 24px 60px rgba(12,70,118,.18);
  --ring: 0 0 0 3px rgba(17,109,255,.18);
}
body {
  font-family: "Helvetica Neue", "Segoe UI", "PingFang HK", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: var(--bg); background-attachment: fixed; color: var(--text);
  line-height: 1.55; -webkit-font-smoothing: antialiased; letter-spacing: .1px;
}
h1 { font-size: 19px; font-weight: 700; letter-spacing: .2px; }
h2 { font-size: 15px; margin-bottom: 10px; font-weight: 650; color: var(--ink); }
a { color: var(--primary); text-decoration: none; }
.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }

button, .btn {
  display: inline-block; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); border-radius: 10px; padding: 9px 18px; font-size: 14px; font-weight: 550;
  cursor: pointer; text-align: center; text-decoration: none; transition: .18s ease;
  box-shadow: var(--shadow-sm); white-space: nowrap; flex: 0 0 auto;
}
button:hover, .btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
button:active, .btn:active { transform: translateY(0); }
button.primary, .btn.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--brand) 100%);
  border: none; color: #fff; box-shadow: 0 8px 22px rgba(17,109,255,.32);
}
button.primary:hover { background: linear-gradient(135deg, var(--primary-dark), var(--brand-600)); }
button.secondary, .btn.secondary { background: #eef3fb; border-color: #dfe7f3; }
button.danger { color: var(--danger); border-color: #f2cfcb; background: #fdf4f3; box-shadow: none; }
button.danger:hover { background: #fbeae8; }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }

input, select {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px;
  width: 100%; background: #fff; color: var(--text); transition: .15s;
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.link { color: var(--primary); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

header {
  background: rgba(255,255,255,.78); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line); padding: 12px 22px;
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 20; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 11px; }
.logo { height: 38px; width: 38px; border-radius: 10px; box-shadow: var(--shadow-sm); }
.brand .wm { display: flex; flex-direction: column; line-height: 1.05; }
.brand .wm b { font-size: 16px; font-weight: 750; color: var(--brand); letter-spacing: .3px; }
.brand .wm span { font-size: 10.5px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; }

/* admin */
.layout { display: flex; gap: 18px; padding: 20px 22px; align-items: flex-start; }
aside { width: 290px; flex-shrink: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
aside h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
aside form { display: grid; gap: 9px; margin-bottom: 16px; }
#eventList { list-style: none; display: grid; gap: 8px; }
#eventList li { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: .15s; background: #fbfcfe; }
#eventList li:hover { border-color: var(--brand-300); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
#eventList li.active { border-color: var(--primary); background: linear-gradient(180deg,#eef4ff,#e6efff); box-shadow: inset 3px 0 0 var(--primary); }
#eventList li b { color: var(--ink); font-weight: 600; }
#eventList li .muted { display: block; margin-top: 2px; }
main { flex: 1; min-width: 0; }
main.empty { background: linear-gradient(160deg,#ffffff,#f2f6fc); border: 1px dashed var(--brand-300); border-radius: 18px; padding: 90px 40px; text-align: center; color: var(--muted); box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }
.panel-head > div { display: flex; gap: 8px; align-items: center; }
#evTitle { font-size: 20px; font-weight: 750; color: var(--brand); }
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.stats span { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 9px 14px; font-size: 12.5px; color: var(--muted); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; min-width: 66px; }
.stats b { font-size: 19px; color: var(--ink); font-weight: 750; letter-spacing: .3px; }
#dropzone {
  background: linear-gradient(180deg,#fbfcfe,#f4f8fd); border: 2px dashed var(--brand-300);
  border-radius: 16px; padding: 28px; text-align: center; margin-bottom: 14px; transition: .18s; color: var(--ink);
}
#dropzone.drag { border-color: var(--primary); background: #eaf1ff; box-shadow: var(--ring); }
#dropzone p:first-child { font-size: 15px; }
.dz-title { font-size: 15px; color: var(--ink); margin-bottom: 12px; }
.dz-title b { color: var(--brand); }
.index-dash { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.bar.index > div { background: linear-gradient(90deg, var(--ok), #0f7a4f); }
.upl-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; color: var(--ink); }
.upl-meta #indexText { flex: 1; }
.upl-status { display: flex; gap: 8px; margin-top: 8px; }
.chip { background: #eef3fb; color: var(--brand); border: 1px solid #dfe7f3; border-radius: 999px; padding: 3px 12px; font-size: 12px; font-weight: 600; }
.upl-failed { list-style: none; margin-top: 10px; max-height: 160px; overflow: auto; background: #fdf4f3; border: 1px solid #f2cfcb; border-radius: 10px; padding: 8px 12px; font-size: 12.5px; color: var(--danger); }
.upl-failed li { padding: 2px 0; }
.upl-events { list-style: none; margin-top: 10px; max-height: 180px; overflow: auto; background: #f2f7fd; border: 1px solid #dfe7f3; border-radius: 10px; padding: 8px 12px; font-size: 12.5px; color: var(--ink); }
.upl-events li { padding: 2px 0; }
.upl-events li::before { content: "▸ "; color: var(--primary); }

/* 独立上传页 */
body.uploader { max-width: 820px; margin: 0 auto; }
body.uploader header { position: sticky; top: 0; }
.up-wrap { padding: 22px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: var(--shadow); }
.card h2 { font-size: 20px; color: var(--brand); }
.check { cursor: pointer; }
input[name=mode] { width: auto; accent-color: var(--primary); }
body.uploader footer { text-align: center; padding: 14px; font-size: 12px; color: var(--muted); }
.bar { height: 8px; background: #e7ecf4; border-radius: 6px; overflow: hidden; margin: 12px 0 4px; }
.bar > div { height: 100%; width: 0; background: linear-gradient(90deg,var(--primary),var(--brand)); border-radius: 6px; transition: width .2s; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; background: #eef2f8; padding: 5px; border-radius: 12px; width: fit-content; }
.tabs button { border: none; background: transparent; box-shadow: none; padding: 8px 18px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.tabs button:hover { transform: none; box-shadow: none; color: var(--ink); }
.tabs button.active { background: #fff; color: var(--brand); box-shadow: var(--shadow-sm); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm); transition: .18s; }
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tile img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #eef2f8; }
.tile .cap { padding: 7px 10px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 650; padding: 3px 10px; border-radius: 999px; color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.badge.pending { background: linear-gradient(135deg,#f6a13c,var(--warn)); }
.badge.indexed { background: linear-gradient(135deg,#1cae72,var(--ok)); }
.badge.failed { background: linear-gradient(135deg,#e85454,var(--danger)); }
.badge.noface { background: linear-gradient(135deg,#7b879b,#586376); }
.tile .count { position: absolute; top: 8px; right: 8px; background: rgba(18,32,54,.72); backdrop-filter: blur(3px); color: #fff; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
#tab-qr { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); }
#tab-qr img { width: 264px; height: 264px; border-radius: 16px; padding: 12px; background: #fff; margin: 14px 0; box-shadow: var(--shadow); border: 1px solid var(--line); }
#tab-qr input { max-width: 440px; }
.audit-list { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; box-shadow: var(--shadow-sm); overflow: auto; max-height: 60vh; }
.audit-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.audit-table th, .audit-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.audit-table th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--card); }
.audit-table td:last-child { white-space: normal; }
#photoCount { font-size: 12.5px; }
.filter-note { margin-bottom: 12px; }

/* guest */
body.guest { max-width: 660px; margin: 0 auto; box-shadow: 0 0 60px rgba(12,70,118,.06); }
body.guest header { display: block; text-align: center; border-bottom: 1px solid var(--line); position: relative; }
.lang-switch { display: flex; gap: 2px; background: #eef2f8; border-radius: 999px; padding: 3px; flex: 0 0 auto; }
body.guest .lang-switch { position: absolute; top: 10px; right: 12px; }
.lang-switch button { border: none; background: transparent; box-shadow: none; padding: 4px 10px; border-radius: 999px; font-size: 12px; color: var(--muted); cursor: pointer; }
.lang-switch button:hover { transform: none; box-shadow: none; }
.lang-switch button.on { background: #fff; color: var(--brand); font-weight: 700; box-shadow: var(--shadow-sm); }
body.guest header .brand { justify-content: center; }
body.guest header .logo { height: 46px; width: 46px; margin: 2px auto 6px; display: block; }
body.guest .gb-title { font-size: 22px; font-weight: 750; color: var(--brand); margin-top: 2px; letter-spacing: .3px; }
body.guest main { padding: 18px; }
body.guest section { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
body.guest section h2 { font-size: 16px; color: var(--ink); }
body.guest footer { text-align: center; padding: 12px 18px 26px; font-size: 11.5px; color: var(--muted); }
#cameraBox { position: relative; background: radial-gradient(circle at 50% 30%, #16233c, #070d18); border-radius: 14px; overflow: hidden; margin-bottom: 12px; min-height: 140px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
#video, #selfiePreview { width: 100%; display: block; max-height: 440px; object-fit: contain; }
#cameraFallback { color: #cbd5e1; padding: 34px 20px; font-size: 14px; text-align: center; }
#searchBtn { width: 100%; padding: 13px; font-size: 16px; margin-top: 8px; border-radius: 12px; }
.modal { position: fixed; inset: 0; background: rgba(12,25,44,.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-card { background: #fff; border-radius: 20px; padding: 26px; max-width: 470px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.modal-card h2 { color: var(--brand); font-size: 17px; margin-bottom: 6px; }
.modal-card p { font-size: 14px; }
.modal-card ul { margin: 14px 0; font-size: 13px; color: var(--text); list-style: none; display: grid; gap: 9px; }
.modal-card li { position: relative; padding-left: 22px; line-height: 1.5; }
.modal-card li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--primary); font-weight: 800; }
.decline { display: block; margin-top: 12px; text-align: center; width: 100%; color: var(--muted); font-size: 13px; }
.warn-note { color: var(--warn); font-size: 12.5px; }
.modal-card form { display: grid; gap: 10px; margin-top: 14px; }
.danger-text { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; margin: 16px 0 14px; line-height: 1.5; }
.check input { width: auto; margin-top: 2px; accent-color: var(--primary); }
#consentBtn { width: 100%; padding: 12px; border-radius: 12px; }
.spinner { width: 40px; height: 40px; border: 4px solid #e7ecf4; border-top-color: var(--primary); border-radius: 50%; animation: spin .9s linear infinite; margin: 26px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
#stepLoading, #stepMessage { text-align: center; padding: 30px 18px; }
#stepMessage p { font-size: 15px; color: var(--ink); margin-bottom: 16px; }
#resultGrid .tile { cursor: pointer; border: 2px solid transparent; }
#resultGrid .tile.sel { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(17,109,255,.15), var(--shadow); }
#resultGrid .tile .tick {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,.9); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 15px; color: transparent; transition: .15s;
}
#resultGrid .tile.sel .tick { background: linear-gradient(135deg,var(--primary),var(--brand)); color: #fff; border-color: transparent; box-shadow: 0 3px 8px rgba(17,109,255,.4); }
.bottombar { position: sticky; bottom: 0; padding: 14px 0 4px; background: linear-gradient(transparent, var(--card) 34%); }
#downloadBtn { width: 100%; padding: 13px; font-size: 16px; border-radius: 12px; }

/* 宾客相册 */
.g-tabs { display: flex; gap: 6px; margin-bottom: 14px; background: #eef2f8; padding: 5px; border-radius: 12px; }
.g-tabs button { flex: 1; border: none; background: transparent; box-shadow: none; padding: 9px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 14px; }
.g-tabs button:hover { transform: none; box-shadow: none; }
.g-tabs button.active { background: #fff; color: var(--brand); box-shadow: var(--shadow-sm); }
.g-gal-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.gal-list { display: block; }
.gal-day { margin-bottom: 8px; }
.gal-day-h { position: sticky; top: 0; z-index: 5; background: linear-gradient(#f6f8fb, rgba(246,248,251,.86)); backdrop-filter: blur(6px); color: var(--brand); font-weight: 700; font-size: 13px; padding: 8px 2px; letter-spacing: .3px; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
.gitem { position: relative; border-radius: 12px; overflow: hidden; cursor: pointer; border: 2px solid transparent; }
.gitem img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #eef2f8; }
.gitem.sel { border-color: var(--primary); }
.gitem .gtick { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(255,255,255,.7); background: rgba(255,255,255,.55); color: transparent; font-size: 15px; line-height: 1; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.gitem .gtick.on { background: linear-gradient(135deg,var(--primary),var(--brand)); color: #fff; border-color: transparent; }
.gal-end { text-align: center; color: var(--muted); font-size: 13px; padding: 16px; }

/* 全屏快速预览 */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(6,12,22,.94); display: flex; align-items: center; justify-content: center; }
.lb-img { max-width: 100%; max-height: 86vh; object-fit: contain; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lb-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; }
.lb-count { color: #cfd8e6; font-size: 14px; }
.lb-top .btn, .lb-top button { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.2); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: none; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }
.lb-prev { left: 8px; } .lb-next { right: 8px; }
.lb-nav:hover { background: rgba(255,255,255,.22); }
.lb-hint { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #8a93a6; font-size: 12px; }

@media (max-width: 760px) {
  .layout { flex-direction: column; padding: 14px; }
  aside { width: 100%; }
  header { padding: 10px 14px; }
}
