:root {
  --brand: #0b4f8a;
  --brand-deep: #08375f;
  --brand-soft: #e8f2fb;
  --accent: #f59e0b;
  --accent-deep: #c76b00;
  --success: #15803d;
  --success-soft: #e9f8ee;
  --warning: #b45309;
  --warning-soft: #fff5df;
  --danger: #c2413a;
  --danger-soft: #fff0ee;
  --ink: #17212b;
  --muted: #667085;
  --line: #dce4ec;
  --surface: #ffffff;
  --surface-alt: #f4f7fa;
  --shadow: 0 18px 50px rgba(12, 44, 72, .11);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--surface-alt);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
.hidden { display: none !important; }
.container { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: "Cascadia Mono", Consolas, monospace; }
.text-right { text-align: right; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: .2s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(11, 79, 138, .2); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.secondary { background: #fff; color: var(--brand); border-color: var(--line); }
.btn.ghost { background: transparent; color: var(--brand); border-color: rgba(255,255,255,.5); }
.btn.warning { background: var(--accent); color: #2b1b00; }
.btn.danger { background: var(--danger); }
.btn.success { background: var(--success); }
.btn.small { min-height: 34px; padding: 5px 11px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--brand); cursor: pointer;
}

.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid rgba(220,228,236,.85);
  backdrop-filter: blur(14px);
}
.header-inner { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(145deg, var(--brand), #1476bf);
  box-shadow: 0 8px 20px rgba(11,79,138,.24); font-size: 20px;
}
.brand small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; line-height: 1.1; margin-top: 2px; }
.header-nav { display: flex; align-items: center; gap: 22px; color: #445166; font-size: 14px; }
.header-nav a:hover { color: var(--brand); }
.header-phone { font-weight: 700; color: var(--brand); }

.hero {
  position: relative; overflow: hidden;
  padding: 54px 0 70px;
  background:
    radial-gradient(circle at 8% 2%, rgba(245,158,11,.17), transparent 29%),
    radial-gradient(circle at 90% 20%, rgba(20,118,191,.14), transparent 30%),
    linear-gradient(180deg, #f9fbfd, #eef4f9);
}
.hero::after {
  content: ""; position: absolute; inset: auto -90px -130px auto; width: 360px; height: 360px;
  border: 45px solid rgba(11,79,138,.05); border-radius: 50%;
}
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: .88fr 1.12fr; gap: 56px; align-items: start; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px;
  background: var(--warning-soft); color: var(--warning); border: 1px solid #f8ddb2;
  border-radius: 999px; font-size: 13px; font-weight: 800;
}
.hero h1 { margin: 20px 0 18px; font-size: clamp(34px, 4.5vw, 58px); line-height: 1.12; letter-spacing: -.04em; }
.hero h1 span { color: var(--brand); }
.hero-lead { font-size: 17px; color: #526173; max-width: 560px; }
.hero-points { display: grid; gap: 14px; margin: 30px 0; }
.hero-point { display: flex; gap: 13px; align-items: flex-start; }
.point-icon {
  width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center;
  border-radius: 10px; color: var(--brand); background: #fff; box-shadow: 0 6px 18px rgba(12,44,72,.08); font-weight: 800;
}
.hero-point b { display: block; font-size: 15px; }
.hero-point span { color: var(--muted); font-size: 13px; }
.notice-card {
  padding: 17px 18px; border: 1px solid #f7d99f; border-left: 5px solid var(--accent);
  border-radius: 13px; background: #fffaf0; color: #714400; font-size: 14px;
}
.notice-card strong { display: block; margin-bottom: 3px; color: #563100; }

.booking-card, .surface-card {
  background: var(--surface); border: 1px solid rgba(220,228,236,.92);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.booking-card { padding: 28px; }
.card-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.card-heading h2 { margin: 0; font-size: 24px; }
.card-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.safety-badge { padding: 5px 10px; border-radius: 999px; background: var(--success-soft); color: var(--success); font-weight: 700; font-size: 12px; white-space: nowrap; }
.form-section { margin-top: 24px; }
.form-section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-weight: 800; }
.form-section-title span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 7px; color: #39475a; font-size: 13px; font-weight: 700; }
.required::after { content: " *"; color: var(--danger); }
.field input, .field select, .field textarea, .filter-input {
  display: block; width: 100%; min-width: 0; border: 1px solid #ccd7e2; border-radius: 12px; background: #fff;
  color: var(--ink); outline: none; transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
  -webkit-appearance: none; appearance: none;
}
.field input, .field select { height: 48px; min-height: 48px; padding: 0 14px; line-height: 1.2; }
.field select {
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23667085' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 14px 14px;
}
.field input[type="date"], .field input[type="time"] { display: block; line-height: normal; }
.field input[type="number"] { -moz-appearance: textfield; }
.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }
.field input::placeholder, .field textarea::placeholder { color: #93a1b2; }
.field textarea { min-height: 96px; resize: vertical; padding: 12px 14px; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus, .filter-input:focus {
  border-color: #3f8fc7; box-shadow: 0 0 0 3px rgba(63,143,199,.13);
}
.field.invalid input, .field.invalid select { border-color: var(--danger); }
.field-error { min-height: 16px; margin-top: 3px; color: var(--danger); font-size: 12px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe; }
.check-row input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--brand); }
.check-row label { margin: 0; font-weight: 600; color: #39475a; font-size: 13px; cursor: pointer; }
.check-row a { color: var(--brand); text-decoration: underline; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.form-actions .btn { min-width: 190px; }
.form-status { margin-top: 12px; padding: 11px 13px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.submit-loader { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.section { padding: 72px 0; }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 38px; }
.section-head h2 { margin: 0 0 10px; font-size: 32px; letter-spacing: -.02em; }
.section-head p { color: var(--muted); margin: 0; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.step-card { position: relative; padding: 24px 20px; background: #fff; border: 1px solid var(--line); border-radius: 15px; }
.step-num { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--brand); color: #fff; font-weight: 800; }
.step-card h3 { margin: 16px 0 7px; font-size: 17px; }
.step-card p { margin: 0; color: var(--muted); font-size: 13px; }
.site-footer { padding: 26px 0; border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 13px; }
.footer-icp { color: var(--muted); transition: color .18s ease; }
.footer-icp:hover { color: var(--brand); text-decoration: underline; }
.login-legal { margin: 18px 0 0 !important; color: var(--muted); font-size: 12px; text-align: center; }
.admin-footer { display: flex; justify-content: center; padding: 28px 0 4px; color: var(--muted); font-size: 12px; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; }

.result-wrap { min-height: calc(100vh - 140px); padding: 48px 0 70px; background: linear-gradient(180deg, #eef4f9, #f7f9fb); }
.result-shell { max-width: 880px; margin: 0 auto; }
.result-header { text-align: center; margin-bottom: 24px; }
.result-icon { width: 62px; height: 62px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 50%; background: var(--success-soft); color: var(--success); font-size: 30px; font-weight: 900; }
.result-header h1 { margin: 0 0 7px; font-size: 30px; }
.result-header p { margin: 0; color: var(--muted); }
.pass-card { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.pass-top { padding: 20px 26px; color: #fff; background: linear-gradient(135deg, var(--brand-deep), var(--brand)); display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.pass-top small { opacity: .75; }
.pass-top strong { display: block; font-size: 18px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.status-pending { background: var(--warning-soft); color: var(--warning); }
.status-approved { background: var(--success-soft); color: var(--success); }
.status-rejected, .status-cancelled { background: var(--danger-soft); color: var(--danger); }
.status-checked_in { background: #e8f1ff; color: #175cd3; }
.status-checked_out { background: #edf0f3; color: #475467; }
.pass-body { display: grid; grid-template-columns: 290px 1fr; gap: 34px; padding: 30px; align-items: center; }
.qr-panel { text-align: center; }
.qr-box { width: 240px; height: 240px; padding: 12px; margin: 0 auto; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.qr-box svg { width: 100%; height: 100%; }
.qr-caption { margin-top: 10px; color: var(--muted); font-size: 12px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; }
.detail-item small { color: var(--muted); display: block; font-size: 12px; }
.detail-item strong { font-size: 15px; overflow-wrap: anywhere; }
.pass-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 18px 30px 28px; }
.pass-tip { margin: 18px 0 0; padding: 15px 16px; border-radius: 12px; background: #fffaf0; color: #684000; font-size: 13px; }
.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty-state .result-icon { background: #edf0f3; color: #667085; }

/* Admin */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 30px; background: radial-gradient(circle at 20% 20%, rgba(245,158,11,.15), transparent 28%), linear-gradient(145deg, #eaf2f8, #f7f9fb); }
.login-card { width: min(430px, 100%); padding: 34px; background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.login-logo { width: 58px; height: 58px; display: grid; place-items: center; margin-bottom: 20px; border-radius: 16px; background: linear-gradient(145deg, var(--brand), #1476bf); color: #fff; font-size: 26px; }
.login-card h1 { margin: 0 0 6px; }
.login-card > p { margin: 0 0 24px; color: var(--muted); }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 16px; color: #e5edf5; background: linear-gradient(180deg, #0a3f6d, #072f53); display: flex; flex-direction: column; }
.sidebar .brand { padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,.11); }
.sidebar .brand small { color: rgba(255,255,255,.6); }
.side-nav { display: grid; gap: 7px; margin-top: 22px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 11px; padding: 11px 13px; border: 0; border-radius: 10px; color: #c8d8e7; background: transparent; text-align: left; cursor: pointer; }
.nav-item:hover, .nav-item.active { color: #fff; background: rgba(255,255,255,.11); }
.nav-icon { width: 22px; text-align: center; }
.sidebar-user { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid rgba(255,255,255,.11); }
.sidebar-user small { color: rgba(255,255,255,.6); }
.admin-main { min-width: 0; padding: 26px 30px 50px; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 24px; }
.admin-topbar h1 { margin: 0; font-size: 26px; }
.admin-topbar p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; gap: 9px; align-items: center; }
.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 13px; }
.stat-card { min-width: 0; padding: 17px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.stat-card small { color: var(--muted); }
.stat-card strong { display: block; margin-top: 5px; font-size: 27px; line-height: 1.2; }
.stat-card.accent { border-color: #f5d69f; background: #fffbf3; }
.stat-card.success { border-color: #bde1c7; background: #f5fcf7; }
.admin-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 18px; margin-top: 20px; }
.panel { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-body { padding: 18px 19px; }
.trend-chart { height: 210px; display: flex; align-items: flex-end; gap: 12px; padding-top: 10px; }
.trend-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.trend-bar-wrap { width: 100%; height: 158px; display: flex; align-items: flex-end; }
.trend-bar { width: 100%; min-height: 4px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, #2e86c6, var(--brand)); transition: .4s ease; }
.trend-label { color: var(--muted); font-size: 11px; white-space: nowrap; }
.upcoming-list { display: grid; gap: 10px; }
.upcoming-item { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfe; }
.upcoming-item div { display: flex; justify-content: space-between; gap: 10px; }
.upcoming-item small { color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .filter-input { width: auto; min-width: 150px; height: 40px; padding: 0 11px; }
.toolbar .filter-input.search { min-width: 240px; flex: 1; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td { padding: 12px 14px; border-bottom: 1px solid #e8edf2; text-align: left; vertical-align: middle; font-size: 13px; }
th { position: sticky; top: 0; z-index: 2; background: #f7f9fb; color: #526173; font-size: 12px; font-weight: 800; white-space: nowrap; }
tbody tr:hover { background: #fbfdff; }
tbody tr:last-child td { border-bottom: 0; }
.table-actions { display: flex; flex-wrap: wrap; gap: 6px; white-space: nowrap; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.pagination-actions { display: flex; gap: 8px; }
.drawer-mask { position: fixed; inset: 0; z-index: 60; background: rgba(8,24,40,.4); opacity: 0; pointer-events: none; transition: .2s; }
.drawer-mask.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; z-index: 61; top: 0; right: 0; bottom: 0; width: min(520px, 94vw); background: #fff; box-shadow: -18px 0 50px rgba(6,24,42,.18); transform: translateX(105%); transition: .25s ease; overflow: auto; }
.drawer.open { transform: translateX(0); }
.drawer-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 20px 22px; border-bottom: 1px solid var(--line); background: #fff; }
.drawer-head h2 { margin: 0; font-size: 19px; }
.drawer-body { padding: 22px; }
.drawer-section { margin-bottom: 24px; }
.drawer-section h3 { margin: 0 0 12px; font-size: 14px; color: #39475a; }
.drawer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.drawer-item small { display: block; color: var(--muted); font-size: 12px; }
.drawer-item strong { display: block; overflow-wrap: anywhere; }
.log-list { display: grid; gap: 10px; }
.log-item { position: relative; padding-left: 18px; font-size: 13px; }
.log-item::before { content: ""; position: absolute; left: 2px; top: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.log-item small { display: block; color: var(--muted); }
.action-bar { display: flex; flex-wrap: wrap; gap: 9px; padding-top: 18px; border-top: 1px solid var(--line); }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-grid .panel:first-child { grid-column: span 2; }
.toggle-option { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px; border: 1px solid #ccd7e2; border-radius: 12px; background: #fff; cursor: pointer; transition: border-color .18s ease, box-shadow .18s ease; }
.field .toggle-option { display: flex; align-items: center; margin: 0; }
.toggle-option input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.toggle-copy { flex: 1; min-width: 0; display: grid; gap: 1px; }
.toggle-copy strong { color: #39475a; font-size: 13px; line-height: 1.35; }
.toggle-copy small { color: var(--muted); font-size: 12px; line-height: 1.35; font-weight: 500; }
.toggle-switch { position: relative; flex: 0 0 44px; width: 44px; height: 26px; border-radius: 999px; background: #cbd5e1; transition: background-color .18s ease; }
.toggle-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(15, 35, 55, .24); transition: transform .18s ease; }
.toggle-option input:checked ~ .toggle-switch { background: var(--brand); }
.toggle-option input:checked ~ .toggle-switch::after { transform: translateX(18px); }
.toggle-option:focus-within { border-color: #3f8fc7; box-shadow: 0 0 0 3px rgba(63,143,199,.13); }
.toast { position: fixed; z-index: 90; right: 24px; bottom: 24px; max-width: 360px; padding: 13px 16px; border-radius: 12px; color: #fff; background: #1c2b3a; box-shadow: 0 15px 35px rgba(6,24,42,.22); transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { transform: none; opacity: 1; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
.gate-search { max-width: 760px; margin: 0 auto; }
.gate-input-row { display: flex; gap: 10px; }
.gate-input-row input { flex: 1; height: 50px; padding: 0 15px; border: 1px solid #ccd7e2; border-radius: 12px; outline: none; }
.gate-result { margin-top: 20px; }
.gate-pass { padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.scanner-hint { margin-top: 10px; color: var(--muted); font-size: 13px; }

.security-section { padding-bottom: 4px; }
.security-section.bordered { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.security-section h3 { margin: 0 0 13px; font-size: 15px; color: #39475a; }
.gate-page { min-height: calc(100vh - 140px); padding: 48px 0 70px; background: linear-gradient(180deg, #f9fbfd, #eef4f9); }
.gate-login { min-height: 62vh; }
.gate-app { max-width: 980px; margin: 0 auto; }
.gate-app-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.gate-app-head h1 { margin: 12px 0 4px; font-size: clamp(28px, 4vw, 42px); line-height: 1.15; }
.gate-app-head p { margin: 0; color: var(--muted); }
.gate-app-head .eyebrow { margin-bottom: 2px; }
.action-dialog-modal { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; padding: 18px; background: rgba(7, 22, 38, .68); backdrop-filter: blur(7px); }
.action-dialog-card { width: min(460px, 100%); overflow: hidden; border-radius: 18px; background: #fff; box-shadow: 0 28px 70px rgba(4, 19, 34, .32); }
.action-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.action-dialog-body { padding: 20px; }
.action-dialog-body p { margin: 0 0 14px; color: #445166; }
.action-dialog-body textarea { width: 100%; min-height: 96px; padding: 12px 14px; border: 1px solid #ccd7e2; border-radius: 12px; outline: none; resize: vertical; }
.action-dialog-body textarea:focus { border-color: #3f8fc7; box-shadow: 0 0 0 3px rgba(63,143,199,.13); }
.action-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.csv-download-modal { position: fixed; inset: 0; z-index: 125; display: grid; place-items: center; padding: 18px; background: rgba(7, 22, 38, .68); backdrop-filter: blur(7px); }
.csv-download-card { width: min(520px, 100%); overflow: hidden; border-radius: 18px; background: #fff; box-shadow: 0 28px 70px rgba(4, 19, 34, .32); }
.csv-download-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.csv-download-head strong, .csv-download-head small { display: block; }
.csv-download-head small { margin-top: 3px; color: var(--muted); }
.csv-download-body { padding: 20px; }
.csv-file-name { margin-bottom: 16px; padding: 11px 13px; border-radius: 10px; background: var(--surface-alt); color: #39475a; font-family: "Cascadia Mono", Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; }
.csv-download-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.csv-download-actions .btn { flex: 1; min-width: 130px; }
.qr-scanner-modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 18px; background: rgba(7, 22, 38, .72); backdrop-filter: blur(7px); }
.qr-scanner-card { width: min(560px, 100%); overflow: hidden; border-radius: 18px; background: #fff; box-shadow: 0 28px 70px rgba(4, 19, 34, .35); }
.qr-scanner-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.qr-scanner-head strong, .qr-scanner-head small { display: block; }
.qr-scanner-head small { margin-top: 2px; color: var(--muted); font-weight: 500; }
.qr-scanner-body { position: relative; min-height: 250px; background: #101820; }
.qr-scanner-video { width: 100%; min-height: 250px; max-height: 64vh; object-fit: cover; background: #101820; }
.qr-picker { min-height: 270px; display: grid; align-content: center; justify-items: center; gap: 7px; padding: 26px 20px; color: var(--ink); text-align: center; background: #fff; }
.qr-picker-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: var(--brand-soft); color: var(--brand); font-size: 30px; font-weight: 900; }
.qr-picker strong { font-size: 18px; }
.qr-picker p { max-width: 380px; margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.qr-picker-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.qr-scanner-fallback { position: absolute; right: 12px; bottom: 12px; }
.qr-scanner-status { padding: 13px 19px 16px; color: #445166; font-size: 13px; text-align: center; }
.qr-scanner-input { position: fixed; left: -9999px; width: 1px; height: 1px; opacity: 0; }
body.scanner-open { overflow: hidden; }
@media (max-width: 1050px) {
  .hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .hero-copy { max-width: 760px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .container { width: min(100% - 28px, 1180px); }
  .header-nav a { display: none; }
  .header-phone { display: none; }
  .hero { padding-top: 34px; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .pass-body { grid-template-columns: 1fr; }
  .qr-panel { order: -1; }
  .admin-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 15px; }
  .sidebar .brand { padding-bottom: 12px; }
  .side-nav { grid-template-columns: repeat(5, minmax(80px, 1fr)); overflow-x: auto; margin-top: 12px; }
  .nav-item { justify-content: center; white-space: nowrap; }
  .nav-icon { display: none; }
  .sidebar-user { display: none; }
  .admin-main { padding: 20px 16px 40px; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid .panel:first-child { grid-column: span 1; }
}
@media (max-width: 720px) {
  .hero { padding: 30px 0 46px; }
  .hero-grid { gap: 28px; }
  .hero h1 { margin: 14px 0; font-size: clamp(31px, 9vw, 40px); }
  .hero-lead { font-size: 15px; }
  .hero-points { margin: 22px 0; }
  .booking-card { padding: 20px 16px; border-radius: 16px; }
  .card-heading { flex-direction: column; gap: 10px; }
  .safety-badge { align-self: flex-start; }
  .form-section { margin-top: 20px; }
  .form-grid { grid-template-columns: 1fr; gap: 14px; }
  .form-grid .span-2 { grid-column: span 1; }
  .field input, .field select, .field textarea, .filter-input { font-size: 16px; }
  .field input, .field select { height: 50px; min-height: 50px; }
  .field textarea { min-height: 104px; }
  .form-actions { margin-top: 20px; padding-top: 17px; }
  #visitDate, #startTime, #endTime { display: flex; align-items: center; justify-content: center; height: 52px; min-height: 52px; padding: 0 38px 0 12px; text-align: center; line-height: 1; font-size: 18px; font-weight: 800; letter-spacing: .02em; color: var(--brand-deep); }
  #visitDate::-webkit-datetime-edit, #startTime::-webkit-datetime-edit, #endTime::-webkit-datetime-edit { display: flex; align-items: center; justify-content: center; height: 100%; padding: 0; line-height: 1; text-align: center; font-weight: 800; }
  #visitDate::-webkit-date-and-time-value, #startTime::-webkit-date-and-time-value, #endTime::-webkit-date-and-time-value { text-align: center; line-height: 1; }
  .gate-input-row { flex-direction: column; gap: 12px; }
  .gate-input-row input { flex: 0 0 auto; width: 100%; height: 58px; min-height: 58px; padding: 0 16px; font-size: 17px; font-weight: 600; }
  .gate-input-row .btn { width: 100%; min-height: 50px; font-size: 15px; }
  .table-wrap { overflow: visible; border: 0; border-radius: 0; background: transparent; }
  .table-wrap table { min-width: 0; border-collapse: separate; border-spacing: 0; }
  .table-wrap thead { display: none; }
  .table-wrap tbody { display: grid; gap: 12px; }
  .table-wrap tr { display: block; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 8px 24px rgba(12, 44, 72, .06); }
  .table-wrap td { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 8px 0; border: 0; font-size: 14px; text-align: right; }
  .table-wrap td::before { content: attr(data-label); flex: 0 0 86px; color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.5; text-align: left; }
  .table-wrap td + td { border-top: 1px dashed #edf1f5; }
  .table-wrap .cell-content { flex: 1; min-width: 0; text-align: right; }
  .table-wrap .table-actions { width: 100%; justify-content: flex-end; }
  .table-wrap .table-actions .btn { flex: 1; min-height: 44px; padding: 8px 12px; font-size: 14px; }
  .table-wrap td[data-label="状态"] .status-pill { display: inline-flex; }
  .gate-app { display: flex; flex-direction: column; }
  .gate-app-head { display: contents; }
  .gate-app-head > div { order: 1; margin-bottom: 18px; }
  .gate-search { order: 2; }
  #gateLogout { order: 3; width: 100%; min-height: 52px; margin-top: 22px; border-color: var(--line); color: var(--muted); background: #fff; }
  .gate-login { min-height: calc(100vh - 175px); }
  .gate-login .login-card { padding: 26px 20px; }
  .gate-login .login-card .btn { min-height: 52px; margin-top: 26px !important; }
}
@media (max-width: 620px) {
  .qr-scanner-card { border-radius: 14px; }
  .qr-scanner-body, .qr-scanner-video { min-height: 220px; }
  .qr-picker-actions { width: 100%; flex-direction: column; }
  .qr-picker-actions .btn { width: 100%; }
  .qr-scanner-fallback { right: 10px; bottom: 10px; left: 10px; }
  .qr-scanner-fallback .btn { width: 100%; }
  .header-inner { min-height: 64px; gap: 12px; }
  .brand { flex: 1; min-width: 0; }
  .brand > span:last-child { min-width: 0; }
  .brand [data-brand-name] { display: block; max-width: calc(100vw - 96px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .brand small { font-size: 11px; }
  .hero h1 { font-size: clamp(30px, 9vw, 36px); }
  .booking-card { padding: 18px 14px; }
  .card-heading h2 { font-size: 22px; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions .btn { width: 100%; }
  .steps { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; }
  .pass-top { align-items: flex-start; flex-direction: column; }
  .pass-body { padding: 22px 16px; }
  .qr-box { width: 210px; height: 210px; }
  .detail-grid { grid-template-columns: 1fr; }
  .pass-actions { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-topbar { align-items: flex-start; flex-direction: column; }
  .admin-topbar .top-actions { width: 100%; }
  .top-actions .btn { flex: 1; }
  .side-nav { grid-template-columns: repeat(5, 86px); }
  .toolbar .filter-input, .toolbar .filter-input.search { width: 100%; min-width: 0; }
  .drawer-grid { grid-template-columns: 1fr; }
  .gate-input-row { flex-direction: column; }
}
@media print {
  .site-header, .site-footer, .pass-actions, .pass-tip { display: none !important; }
  body, .result-wrap { background: #fff; }
  .result-wrap { padding: 0; }
  .pass-card { box-shadow: none; }
}

/* ==========================================================================
   背景铺满修复（2026-10-06）
   原因：.gate-page / .result-wrap 用 min-height: calc(100vh - 140px) 估算高度，
   手机端头部(65)+页脚(155)=220px，估算少了 80px，主区渐变背景铺不满，
   页面底部露出 body 的纯色底，需要滚动才能看全 → 视觉上"背景不完整"。
   改为 flex 撑满：主区自动占满剩余高度，页脚自然贴底，内容高时正常滚动。
   ========================================================================== */
body[data-page="gate"],
body[data-page="verify"],
body[data-page="success"] {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
/* 主区高度交给 flex，不再用 vh 减固定值估算 */
body[data-page="gate"] > .gate-page,
body[data-page="verify"] > .result-wrap,
body[data-page="success"] > .result-wrap {
  flex: 1 1 auto;
  min-height: 0;
}
/* 门岗登录：卡片在剩余空间里垂直居中 */
body[data-page="gate"] > .gate-page { display: flex; flex-direction: column; }
body[data-page="gate"] > .gate-page > .container { flex: 1 1 auto; display: flex; flex-direction: column; }
body[data-page="gate"] .gate-login { flex: 1 1 auto; min-height: 0; }
/* 页脚贴底 */
body[data-page="gate"] > .site-footer,
body[data-page="verify"] > .site-footer,
body[data-page="success"] > .site-footer { margin-top: auto; }

/* 手机端压缩留白：让门岗登录 / 扫码核验尽量一屏放下，页脚也更紧凑
   （此前手机端页脚 155px、登录区上下留白偏大，标准手机上要多滚 50~230px） */
@media (max-width: 620px) {
  body[data-page="gate"] > .gate-page,
  body[data-page="verify"] > .result-wrap,
  body[data-page="success"] > .result-wrap { padding: 24px 0 30px; }
  body[data-page="gate"] .gate-login { padding: 14px; }
  body[data-page="gate"] .gate-login .login-card { padding: 22px 18px; border-radius: 18px; }
  body[data-page="gate"] .gate-login .login-card h1 { font-size: 24px; }
  body[data-page="gate"] .gate-login .login-card > p { margin-bottom: 16px; font-size: 14px; }
  body[data-page="gate"] .gate-login .login-card .btn { margin-top: 16px !important; }
  .site-footer { padding: 14px 0; font-size: 12px; }
  .footer-inner { flex-direction: column; gap: 3px; align-items: center; text-align: center; }
}

/* 门岗登录：去掉登录区自带的那层背景（它只有 1180px 容器宽，
   桌面上会露出两侧纯色、手机上会露出四周，看起来像"背景不完整"）。
   改为整页统一背景，橙色光晕也移到整页上，视觉更完整。 */
body[data-page="gate"] > .gate-page {
  background:
    radial-gradient(circle at 22% 12%, rgba(245, 158, 11, .14), transparent 34%),
    radial-gradient(circle at 88% 78%, rgba(11, 79, 138, .10), transparent 38%),
    linear-gradient(180deg, #f9fbfd, #eef4f9);
}
body[data-page="gate"] .gate-login { background: none; }
