:root {
  --ink: #26201d;
  --muted: #746a64;
  --line: #ded5cf;
  --paper: #f4f2ef;
  --surface: #ffffff;
  --forest: #71351f;
  --forest-2: #934a28;
  --gold: #d4a75e;
  --charcoal: #252725;
  --success: #17613e;
  --danger: #a13e34;
  --warning: #8a5b12;
  --radius: 6px;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 280px; background: var(--paper); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; background: var(--paper); }
img { display: block; max-width: 100%; }
button, input { font: inherit; }
a { color: inherit; }
.topbar { min-height: 68px; padding: max(10px, env(safe-area-inset-top)) max(clamp(20px, 4vw, 56px), env(safe-area-inset-right)) 10px max(clamp(20px, 4vw, 56px), env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--charcoal); color: white; border-bottom: 3px solid var(--gold); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-logo-top { width: 54px; aspect-ratio: 321 / 240; height: auto; flex: 0 0 54px; object-fit: contain; object-position: center; background: white; border-radius: 3px; }
.brand span:last-child { display: grid; }
.brand strong { font-size: 1rem; }
.brand small { margin-top: 2px; color: rgba(255,255,255,.68); font-size: .75rem; }
.system-state { font-size: .82rem; color: #eee1d7; }
.app-nav { display: flex; align-items: center; gap: 4px; }
.admin-nav-wrap { display: flex; align-items: center; gap: 8px; }
.app-nav a { min-height: 40px; display: inline-grid; place-items: center; padding: 8px 14px; border-radius: 4px; color: #d8d2ce; font-size: .88rem; font-weight: 700; text-decoration: none; }
.app-nav a:hover { color: white; background: rgba(255,255,255,.08); }
.app-nav a.active { color: #fff6e6; background: var(--forest-2); }
.admin-session { min-height: 40px; padding-left: 12px; display: flex; align-items: center; gap: 9px; border-left: 1px solid rgba(255,255,255,.18); }
.admin-name { max-width: 100px; overflow: hidden; color: #bcb7b3; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.logout-form { margin: 0; }
.logout-button { min-height: 34px; padding: 6px 10px; border: 1px solid rgba(212,167,94,.58); background: transparent; color: #f1dcc4; font-size: .78rem; }
.logout-button:hover { border-color: var(--gold); background: #3a302b; color: white; }
.workspace { width: min(1180px, calc(100% - 32px)); margin: 32px auto 56px; display: grid; grid-template-columns: minmax(0, .78fr) minmax(0, 1.42fr); gap: 24px; align-items: start; }
.workspace > *, .reservation-form > *, .pass-details > *, .verify-details > * { min-width: 0; }
.form-panel, .records, .share-panel, .verify-sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.form-panel, .records { padding: 24px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-heading.compact { margin-bottom: 14px; align-items: center; }
.eyebrow { margin: 0 0 6px; color: var(--forest-2); font-size: .76rem; font-weight: 700; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 1.5rem; }
h2 { margin-bottom: 0; font-size: 1.2rem; }
.date-chip, .count { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.reservation-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { display: grid; gap: 7px; color: #36413f; font-size: .88rem; font-weight: 650; }
input { width: 100%; min-width: 0; min-height: 44px; border: 1px solid #bdc7c3; border-radius: 4px; padding: 9px 11px; background: #fff; color: var(--ink); outline: none; }
input:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(36,91,80,.12); }
.full { grid-column: 1 / -1; }
button, .button-link { min-height: 44px; border: 0; border-radius: 4px; padding: 10px 16px; cursor: pointer; font-weight: 700; }
.primary { background: var(--forest); color: white; }
.primary:hover { background: var(--forest-2); }
.secondary { border: 1px solid var(--forest); background: white; color: var(--forest); }
.notice { width: min(760px, 100%); margin: 0 auto 18px; padding: 13px 15px; border-radius: 4px; border: 1px solid; font-size: .9rem; }
.notice.success { color: #69341f; border-color: #d9b789; background: #fff7e9; }
.notice.error { color: var(--danger); border-color: #e4bcb6; background: #fff4f2; }
.notice.warning { color: var(--warning); border-color: #e8d0a6; background: #fff9ed; }
.table-wrap { overflow-x: auto; overscroll-behavior-inline: contain; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th { padding: 10px 9px; color: var(--muted); border-bottom: 1px solid var(--line); text-align: left; font-size: .75rem; font-weight: 650; white-space: nowrap; }
td { padding: 13px 9px; border-bottom: 1px solid #edf0ee; vertical-align: middle; white-space: nowrap; }
td small { display: block; margin-top: 3px; color: var(--muted); }
.mono { font-family: "SFMono-Regular", Consolas, monospace; }
.status { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 9px; border-radius: 999px; font-size: .76rem; font-weight: 750; }
.status.pending { color: #72500f; background: #fff3cf; }
.status.used { color: #6b351f; background: #f3dfc4; }
.status.cancelled { color: #5f5a56; background: #e9e4e0; }
.text-link { color: var(--forest-2); font-size: .84rem; font-weight: 700; text-underline-offset: 3px; }
.topbar .text-link { color: #eee1d7; }
.empty-state { min-height: 210px; display: grid; place-content: center; gap: 6px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); }
.mobile-records { display: none; }
.card-page, .verify-page { width: min(720px, calc(100% - 32px)); margin: 24px auto 52px; }
.visit-pass { overflow: hidden; background: #fff; border: 1px solid #c8d0cd; border-radius: var(--radius); box-shadow: 0 18px 44px rgba(18,42,37,.08); }
.pass-header { min-height: 104px; padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; color: white; background: linear-gradient(110deg, #572817, var(--forest)); border-bottom: 3px solid var(--gold); }
.pass-title { min-width: 0; display: grid; justify-items: start; }
.pass-header p { margin-bottom: 3px; color: #ead8ca; font-size: .72rem; }
.pass-header h1 { margin-bottom: 7px; font-size: 1.55rem; }
.pass-header .status { min-height: 24px; padding-block: 2px; }
.pass-logo { width: 112px; aspect-ratio: 321 / 240; height: auto; flex: 0 0 auto; object-fit: contain; object-position: center; background: white; border-radius: 3px; }
.pass-body { padding: 18px 20px; }
.guest-line { display: flex; align-items: baseline; gap: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.guest-line span, dt, .qr-area span { color: var(--muted); font-size: .8rem; }
.guest-line strong { min-width: 0; overflow-wrap: anywhere; font-size: 1.18rem; }
.pass-details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 12px 0 14px; }
dl, dd { margin: 0; }
.pass-details dd { margin-top: 4px; font-weight: 750; }
.qr-area { display: grid; grid-template-columns: minmax(190px, 220px) minmax(0, 1fr); align-items: center; gap: 20px; padding: 12px; background: #f5f1ee; border: 1px solid #e2d8d1; }
.qr-area img { width: min(210px, 100%); height: auto; aspect-ratio: 1; background: white; }
.qr-area div { display: grid; gap: 8px; }
.verify-code { max-width: 100%; white-space: nowrap; color: var(--forest); font-size: clamp(2rem, 7vw, 3.2rem); letter-spacing: .08em; line-height: 1.1; }
.qr-area small { color: var(--muted); }
.pass-footer { padding: 10px 20px; display: flex; justify-content: space-between; gap: 16px; background: #eee9e5; color: var(--muted); font-size: .76rem; }
.share-panel { margin-top: 18px; padding: 18px; display: grid; gap: 14px; }
.share-panel > div:first-child { display: grid; gap: 4px; }
.share-panel span { color: var(--muted); font-size: .82rem; }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.card-actions { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card-actions form, .card-actions button { width: 100%; }
.danger-outline { border: 1px solid #b35749; background: #fff; color: var(--danger); }
.danger-outline:hover { background: #fff1ee; }
.verify-sheet { overflow: hidden; }
.verify-state { padding: 24px; display: flex; justify-content: space-between; align-items: center; color: white; background: var(--forest); }
.verify-state.used { background: #6a3420; }
.verify-state.cancelled { background: #625b56; }
.verify-state span { font-size: 1.3rem; font-weight: 800; }
.verify-state strong { overflow-wrap: anywhere; font-family: Consolas, monospace; font-size: .9rem; }
.verify-details { padding: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.verify-details div { padding-bottom: 14px; border-bottom: 1px solid #e5e9e7; }
.verify-details .wide { grid-column: 1 / -1; }
.verify-details dd { margin-top: 7px; overflow-wrap: anywhere; font-size: 1.02rem; font-weight: 750; }
.redeem-form { padding: 22px 24px 26px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; background: #f7f2ed; border-top: 1px solid var(--line); }
.locked-state { padding: 24px; display: grid; gap: 5px; background: #f5efea; border-top: 1px solid var(--line); }
.locked-state span { color: var(--muted); font-size: .86rem; }
.scan-page { width: min(680px, calc(100% - 32px)); margin: 28px auto 56px; }
.scan-panel { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.scan-heading { align-items: center; }
.scan-badge { color: var(--forest-2); font-size: .78rem; font-weight: 750; }
.reader { min-height: 260px; overflow: hidden; display: grid; place-items: center; border: 1px dashed #b7a8a0; border-radius: 5px; background: #292a28; color: white; }
.reader:empty::before { content: "二维码扫描区域"; color: #bcb7b3; font-size: .9rem; }
.reader video { object-fit: cover; }
.scan-message { width: 100%; }
.scan-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.file-button { min-height: 44px; display: grid; place-items: center; border-radius: 4px; cursor: pointer; font-weight: 700; }
input.visually-hidden { position: absolute; width: 1px; min-width: 1px; height: 1px; min-height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.manual-code { margin-top: 20px; padding-top: 18px; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 12px; border-top: 1px solid var(--line); }
.manual-code input { font-family: Consolas, monospace; letter-spacing: .16em; }
.list-page { width: min(1180px, calc(100% - 32px)); margin: 32px auto 56px; }
.reservation-directory { padding: 24px; }
.list-heading { margin-bottom: 18px; align-items: center; }
.date-switcher { margin-bottom: 14px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.date-option { min-width: 0; padding: 10px 6px; display: grid; justify-items: center; gap: 3px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); text-decoration: none; }
.date-option strong { font-size: .86rem; }
.date-option span { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.date-option:hover { border-color: #bd8c70; background: #fbf6f2; }
.date-option.active { border-color: var(--forest-2); background: var(--forest-2); color: white; }
.date-option.active span { color: #f1ddd1; }
.search-bar { padding: 18px; background: #f5f0ec; border: 1px solid #e2d6ce; border-radius: 5px; }
.search-bar > label { margin-bottom: 8px; }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
.search-summary { margin: 16px 0 4px; color: var(--muted); font-size: .86rem; }
.mobile-record-codes { display: flex; justify-content: space-between; gap: 10px; color: var(--forest-2); font-size: .76rem; }
.mobile-record-codes strong { color: var(--ink); letter-spacing: .08em; }
.login-page { width: min(460px, calc(100% - 32px)); min-height: 100vh; min-height: 100dvh; margin: auto; padding: 28px 0; display: grid; place-items: center; }
.login-panel { width: 100%; overflow: hidden; background: var(--surface); border: 1px solid #cfc5be; border-radius: var(--radius); box-shadow: 0 20px 50px rgba(38,32,29,.12); }
.login-brand { min-height: 124px; padding: 22px 26px; display: flex; align-items: center; gap: 18px; background: var(--charcoal); border-bottom: 3px solid var(--gold); color: white; }
.login-brand > div { min-width: 0; }
.login-brand p { margin-bottom: 5px; color: #d8b990; font-size: .72rem; }
.login-brand h1 { overflow-wrap: anywhere; font-size: 1.35rem; }
.login-logo { width: 96px; aspect-ratio: 321 / 240; height: auto; flex: 0 0 96px; object-fit: contain; background: white; border-radius: 3px; }
.login-content { padding: 26px; }
.login-heading { margin-bottom: 22px; }
.login-heading h2 { font-size: 1.18rem; }
.login-error { margin: -6px 0 18px; padding: 11px 13px; border-left: 3px solid var(--danger); background: #fff2f0; color: #8d332a; font-size: .86rem; }
.login-form { display: grid; gap: 17px; }
.login-form input { min-height: 48px; }
.login-form button { min-height: 48px; margin-top: 3px; }
.error-page { width: min(520px, calc(100% - 32px)); min-height: 70vh; margin: auto; display: grid; place-content: center; justify-items: center; text-align: center; }
.error-page .brand-mark { margin-bottom: 20px; background: var(--forest); }
.error-page h1 { margin-bottom: 10px; }
.error-page p { color: var(--muted); }
.button-link { display: inline-grid; place-items: center; margin-top: 12px; text-decoration: none; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .records { padding: 20px 14px; }
}

@media (max-width: 620px) {
  .topbar { min-height: 60px; padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); gap: 10px; }
  .system-state { display: none; }
  .app-header .brand small { display: none; }
  .app-header .brand > span { display: none; }
  .app-nav { gap: 2px; }
  .app-nav a { min-height: 40px; padding: 7px 9px; font-size: .82rem; }
  .workspace, .card-page, .verify-page, .list-page { width: auto; margin: 16px max(12px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .form-panel { padding: 20px; }
  .reservation-form { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  label { font-size: .9rem; }
  input { min-height: 48px; font-size: 1rem; }
  button, .button-link { min-height: 48px; }
  .records { padding: 18px 16px; }
  .table-wrap { display: none; }
  .mobile-records { display: grid; gap: 10px; }
  .mobile-record { display: grid; gap: 9px; padding: 14px; border: 1px solid var(--line); border-radius: 5px; color: inherit; text-decoration: none; background: #fbfcfb; }
  .mobile-record:active { background: #f1f5f3; }
  .mobile-record-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
  .mobile-record-head strong { min-width: 0; overflow-wrap: anywhere; font-size: 1rem; }
  .mobile-record-meta { display: grid; grid-template-columns: 1fr auto; gap: 8px; color: var(--muted); font-size: .82rem; }
  .mobile-record-reference { color: var(--forest-2); font-size: .76rem; overflow-wrap: anywhere; }
  .card-page { margin-top: 10px; }
  .pass-header { min-height: 86px; padding: 10px 12px 10px 14px; }
  .pass-header h1 { margin-bottom: 5px; font-size: 1.18rem; }
  .pass-header p { font-size: .65rem; }
  .pass-logo { width: 92px; }
  .pass-body { padding: 12px 14px; }
  .guest-line { padding-bottom: 8px; }
  .guest-line strong { font-size: 1.05rem; }
  .pass-details { grid-template-columns: 1.35fr 1fr .8fr; gap: 8px; margin: 9px 0 10px; }
  .pass-details dt, .guest-line span { font-size: .72rem; }
  .pass-details dd { font-size: .86rem; }
  .qr-area { grid-template-columns: minmax(145px, 58%) minmax(0, 1fr); justify-items: stretch; text-align: left; gap: 10px; padding: 9px; }
  .qr-area img { width: 100%; }
  .qr-area div { justify-items: start; gap: 5px; }
  .verify-code { font-size: clamp(1.4rem, 7vw, 1.9rem); letter-spacing: .03em; }
  .qr-area small { font-size: .7rem; line-height: 1.45; }
  .pass-footer { padding: 8px 14px; font-size: .68rem; }
  .copy-row, .redeem-form { grid-template-columns: 1fr; }
  .copy-row button, .redeem-form button { width: 100%; }
  .verify-state { align-items: flex-start; flex-direction: column; gap: 9px; }
  .verify-details { grid-template-columns: 1fr; }
  .verify-details .wide { grid-column: auto; }
  .share-panel { padding: 16px; }
  .error-page { width: auto; margin-inline: max(20px, env(safe-area-inset-left)); }
  .scan-page { width: auto; margin: 16px max(12px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .scan-panel { padding: 18px 14px; }
  .reader { min-height: 230px; }
  .scan-actions, .manual-code { grid-template-columns: 1fr; }
  .scan-actions > *, .manual-code button { width: 100%; min-height: 48px; }
  .reservation-directory { padding: 18px 14px; }
  .date-switcher { grid-template-columns: repeat(6, minmax(76px, 1fr)); overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
  .date-option { min-height: 58px; }
  .search-bar { padding: 14px; }
  .search-row { grid-template-columns: 1fr auto; }
  .search-row .secondary { grid-column: 1 / -1; margin-top: 0; }
  .admin-nav-wrap { gap: 3px; }
  .admin-session { padding-left: 4px; gap: 0; }
  .admin-name { display: none; }
  .logout-button { min-height: 36px; padding-inline: 7px; font-size: .74rem; }
  .login-page { width: auto; margin-inline: max(16px, env(safe-area-inset-left)); }
  .login-brand { min-height: 106px; padding: 17px 18px; gap: 14px; }
  .login-logo { width: 84px; flex-basis: 84px; }
  .login-brand h1 { font-size: 1.15rem; }
  .login-content { padding: 22px 18px; }
}

@media (max-width: 380px) {
  .brand { gap: 9px; }
  .brand-logo-top { width: 42px; flex-basis: 42px; }
  .brand strong { font-size: .95rem; }
  .form-panel, .records { padding: 16px 14px; }
  .section-heading { margin-bottom: 20px; }
  h1 { font-size: 1.32rem; }
  .app-nav a { padding-inline: 6px; font-size: .74rem; }
  .logout-button { font-size: 0; width: 34px; padding: 0; }
  .logout-button::after { content: "退出"; font-size: .72rem; }
  .pass-logo { width: 78px; }
  .pass-header h1 { font-size: 1.05rem; }
  .pass-details { gap: 6px; }
  .qr-area { grid-template-columns: minmax(132px, 56%) minmax(0, 1fr); padding: 7px; }
  .verify-code { font-size: clamp(1.25rem, 6.8vw, 1.65rem); }
  .mobile-record-meta { grid-template-columns: 1fr; }
  .verify-state, .verify-details, .redeem-form, .locked-state { padding-left: 18px; padding-right: 18px; }
  .card-actions { grid-template-columns: 1fr; gap: 8px; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .topbar { min-height: 56px; padding-top: 8px; padding-bottom: 8px; }
  .workspace, .card-page, .verify-page { margin-top: 12px; }
  .qr-area { grid-template-columns: minmax(150px, 200px) 1fr; text-align: left; }
  .qr-area img { width: min(200px, 42vh); }
}
