:root {
  color-scheme: light;
  --paper: #f8f4ec;
  --paper-deep: #eee7da;
  --surface: #fffdf8;
  --surface-raised: #fffefa;
  --ink: #45413a;
  --muted: #777269;
  --faint: #a39c91;
  --line: #dfd6c8;
  --line-soft: #eee7dc;
  --red: #a65f54;
  --red-dark: #8f4f46;
  --red-soft: #f7e8e2;
  --green: #718c7c;
  --green-soft: #e9f0e9;
  --gold: #b88d57;
  --shadow-sm: 0 1px 2px rgba(91, 72, 52, 0.04), 0 5px 18px rgba(91, 72, 52, 0.045);
  --shadow-lg: 0 24px 64px rgba(91, 72, 52, 0.14), 0 4px 16px rgba(91, 72, 52, 0.07);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --sidebar: 250px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--paper); }
html.dialog-scroll-lock { overflow: hidden; overscroll-behavior: none; }
body.dialog-scroll-lock { position: fixed; width: 100%; overflow: hidden; overscroll-behavior: none; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, a, label, select { -webkit-tap-highlight-color: transparent; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
#i-grid path { fill: currentColor; stroke: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 20; display: flex; flex-direction: column; padding: 28px 18px 22px; border-right: 1px solid #e6dccd; background: #fffaf1; color: var(--ink); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border: 1px solid #d9b7ad; border-radius: 50%; color: var(--red); background: #fffdf8; font-family: "Songti TC", "Noto Serif TC", Georgia, serif; font-size: 19px; }
.brand > span:last-child { display: flex; flex-direction: column; }
.brand strong { font-family: "Songti TC", "Noto Serif TC", Georgia, serif; font-size: 18px; letter-spacing: .12em; }
.brand small { margin-top: 1px; color: var(--faint); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.event-summary { margin: 38px 10px 27px; padding: 0 0 25px; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 7px; }
.eyebrow { color: var(--red); font-size: 10px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.event-summary .eyebrow { color: var(--red); }
.event-summary strong { font-family: "Songti TC", "Noto Serif TC", Georgia, serif; font-size: 17px; line-height: 1.45; }
.event-summary > span:last-child { color: var(--muted); font-size: 12px; line-height: 1.5; }
.main-nav { display: flex; flex-direction: column; gap: 5px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 13px; width: 100%; padding: 11px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 14px; text-align: left; cursor: pointer; transition: background-color 160ms ease, color 160ms ease, transform 120ms var(--ease-out); }
.nav-item svg { width: 18px; height: 18px; }
.nav-item.is-active { background: var(--red-soft); color: var(--red-dark); }
.nav-item.is-active::before { content: ""; position: absolute; left: -18px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 2px 2px 0; background: var(--red); }
.sync-state i { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: #71977a; box-shadow: 0 0 0 3px rgba(113,151,122,.12); }

.main-column { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 42px; border-bottom: 1px solid rgba(159,151,140,.28); background: rgba(248,244,236,.92); backdrop-filter: blur(16px); }
.topbar-title { display: flex; flex-direction: column; gap: 4px; }
.topbar-title .eyebrow { color: var(--faint); font-size: 9px; }
.topbar-title strong { font-family: "Songti TC", "Noto Serif TC", Georgia, serif; font-size: 17px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.sync-state { display: inline-flex; align-items: center; gap: 8px; min-height: 35px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.48); color: var(--muted); box-shadow: var(--shadow-sm); font-size: 11px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.sync-state.is-saving i { background: var(--gold); animation: sync-pulse 900ms ease-in-out infinite; }
.sync-state.is-offline i { background: var(--gold); }
.sync-state.is-error i { background: var(--red); }
.content { max-width: 1440px; margin: 0 auto; padding: 40px 42px 64px; }
.view { display: none; }
.view.is-active { display: block; }

.initializing { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 35%, #fffdf8 0, #faf4e9 48%, #f3ecdf 100%); color: var(--ink); }
.initializing-card { display: flex; flex-direction: column; align-items: center; max-width: 360px; text-align: center; }
.initializing-spinner { width: 46px; height: 46px; margin-bottom: 24px; border: 3px solid var(--red-soft); border-top-color: var(--red); border-radius: 50%; animation: wedding-spin 800ms linear infinite; }
.initializing-card h1 { margin: 16px 0 9px; font-size: clamp(27px, 5vw, 38px); }
.initializing-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.initializing-status { margin-top: 22px; }

h1, h2, p { margin-top: 0; }
h1, h2 { font-family: "Songti TC", "Noto Serif TC", Georgia, serif; font-weight: 650; }
h1 { margin-bottom: 10px; font-size: clamp(30px, 3vw, 42px); letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: -.02em; }
.hero-row, .section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 32px; }
.hero-row h1, .section-heading h1 { margin-top: 9px; }
.hero-row p, .section-heading p { margin-bottom: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.section-heading { align-items: center; }
.guest-heading-actions { display: flex; gap: 10px; flex-shrink: 0; }
.shared-guest-page .topbar { gap: 16px; }
.shared-guest-page .topbar-title { min-width: 0; }
.shared-guest-page .topbar-title strong,
.shared-guest-page .topbar-title .eyebrow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 42px; padding: 0 18px; border: 1px solid transparent; border-radius: 7px; font-size: 13px; font-weight: 700; letter-spacing: .01em; cursor: pointer; transition: transform 130ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease; }
.button svg { width: 17px; height: 17px; }
.button:active, .icon-button:active, .nav-item:active, .table-action:active, .result-row:active { transform: scale(.97); }
.button-primary { background: var(--red); color: white; box-shadow: 0 4px 12px rgba(166,95,84,.18); }
.button-secondary { border-color: var(--line); background: rgba(255,255,255,.48); color: var(--ink); box-shadow: var(--shadow-sm); }
.button-danger { background: var(--red); color: white; }
.topbar-actions > .sync-state,
.topbar-actions > .topbar-device { height: 35px; min-height: 35px; line-height: 1; }
.topbar-actions > .topbar-device { padding: 0 12px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.button.is-loading { cursor: wait; }
.button.is-loading::before { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: wedding-spin 700ms linear infinite; }
.button:disabled { cursor: wait; opacity: .68; }
.button-full { width: 100%; }
.button.compact { min-height: 35px; padding-inline: 13px; font-size: 12px; }
.align-start { align-self: flex-start; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; transition: transform 130ms var(--ease-out), background-color 160ms ease; }
.icon-button.mobile-menu { display: none; }
.text-button { display: inline-flex; align-items: center; gap: 5px; padding: 4px 0; border: 0; background: none; color: var(--red); font-size: 12px; font-weight: 700; cursor: pointer; }
.text-button svg { width: 14px; height: 14px; }

.metric-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.metric-card, .panel { border: 1px solid var(--line); border-radius: 12px; background: rgba(255,253,249,.78); box-shadow: var(--shadow-sm); }
.metric-card { min-height: 184px; padding: 24px; }
.metric-primary { background: #edf2ea; color: var(--ink); border-color: #d6e0d4; }
.metric-label { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .05em; }
.metric-primary .metric-label { color: var(--green); }
.metric-kicker { padding: 4px 8px; border-radius: 99px; background: rgba(255,255,255,.72); color: var(--green); box-shadow: inset 0 0 0 1px rgba(113,140,124,.13); font-size: 10px; }
.metric-icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; background: var(--red-soft); color: var(--red); font-family: "Songti TC", Georgia, serif; }
.metric-card > strong { display: block; margin-top: 19px; font-family: "Songti TC", "Noto Serif TC", Georgia, serif; font-size: 35px; font-weight: 600; letter-spacing: -.04em; }
.metric-card > strong small { color: inherit; font-size: 14px; font-weight: 500; letter-spacing: 0; }
.metric-card > p { margin: 16px 0 0; color: var(--muted); font-size: 11px; }
.metric-primary > p { margin-top: 10px; color: var(--muted); }
.progress-track { height: 4px; margin-top: 21px; overflow: hidden; border-radius: 99px; background: rgba(113,140,124,.14); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width 240ms var(--ease-out); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(270px, .8fr); gap: 18px; }
.panel { padding: 24px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.panel-heading h2 { margin-top: 7px; }
.recent-list { min-height: 222px; }
.recent-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 13px 2px; border-top: 1px solid var(--line-soft); }
.recent-row:first-child { border-top: 0; }
.guest-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--red-soft); color: var(--red); font-family: "Songti TC", Georgia, serif; font-weight: 700; }
.guest-avatar.tone-2 { background: #e7ebe3; color: #4f6652; }
.guest-avatar.tone-3 { background: #ece5d9; color: #816845; }
.recent-info { min-width: 0; }
.recent-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.recent-info span { color: var(--muted); font-size: 10px; }
.recent-amount { text-align: right; }
.recent-amount strong { display: block; font-family: "Songti TC", Georgia, serif; font-size: 13px; }
.recent-amount time { color: var(--faint); font-size: 9px; }
.table-progress-list { display: flex; flex-direction: column; gap: 20px; }
.table-progress-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 11px; }
.table-progress-header span:last-child { color: var(--muted); }
.table-progress-track { height: 5px; border-radius: 99px; background: var(--paper-deep); overflow: hidden; }
.table-progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--red); transition: width 220ms var(--ease-out); }
.empty-state { display: grid; place-items: center; align-content: center; min-height: 200px; padding: 30px; text-align: center; color: var(--muted); }
.empty-state strong { margin-bottom: 6px; color: var(--ink); font-family: "Songti TC", Georgia, serif; font-size: 16px; }
.empty-state p { max-width: 300px; margin: 0; font-size: 12px; line-height: 1.6; }

.today-counter { padding: 13px 18px; border-left: 2px solid var(--red); text-align: right; }
.today-counter span { display: block; color: var(--muted); font-size: 10px; }
.today-counter strong { display: block; margin-top: 4px; font-family: "Songti TC", Georgia, serif; font-size: 24px; }
.today-counter small { font-size: 11px; }
.reception-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(310px, .75fr); gap: 20px; align-items: start; }
.reception-layout.is-search-only { grid-template-columns: minmax(0, 1fr); }
.reception-layout.is-editing { grid-template-columns: minmax(0, 1fr); }
.reception-search-area { min-width: 0; }
.search-box { display: flex; align-items: center; gap: 13px; min-height: 62px; padding: 0 17px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-raised); box-shadow: var(--shadow-sm); transition: border-color 160ms ease, box-shadow 160ms ease; }
.search-box:focus-within { border-color: #b57a74; box-shadow: 0 0 0 3px rgba(159,61,54,.09), var(--shadow-sm); }
.search-box svg { color: var(--red); }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 16px; }
.search-box input::placeholder { color: #a5a49e; }
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-clear { flex: 0 0 auto; width: 30px; height: 30px; color: var(--muted); }
.search-clear svg { width: 16px; height: 16px; color: currentColor; }
.search-clear:focus-visible { outline: 3px solid rgba(159,61,54,.14); outline-offset: 1px; }
kbd { padding: 4px 7px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--paper); color: var(--faint); font-family: inherit; font-size: 9px; }
.search-meta { display: flex; justify-content: space-between; padding: 10px 4px; color: var(--faint); font-size: 10px; }
.reception-results { display: flex; flex-direction: column; gap: 7px; }
.reception-search-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.reception-add-button { min-width: 158px; min-height: 62px; border-radius: 10px; background: var(--surface-raised); white-space: nowrap; }
.result-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto auto; align-items: center; gap: 13px; width: 100%; min-height: 70px; padding: 11px 13px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(255,253,249,.75); text-align: left; cursor: pointer; transition: transform 130ms var(--ease-out), border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease; }
.result-row.is-selected { border-color: #bc7f79; background: var(--surface-raised); box-shadow: 0 0 0 2px rgba(159,61,54,.07); }
.result-main { min-width: 0; }
.result-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.result-main mark { padding: 0; background: transparent; color: var(--red); font-weight: 800; }
.result-main span { color: var(--muted); font-size: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 99px; background: var(--paper-deep); color: var(--muted); font-size: 9px; white-space: nowrap; }
.status-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.status-pill.is-done { background: var(--green-soft); color: var(--green); }
.status-pill.is-done::before { background: var(--green); }
.result-arrow { color: var(--faint); }
.reception-editor { width: min(560px, calc(100vw - 24px)); max-height: min(760px, calc(100dvh - 32px)); margin: auto; padding: 0; overflow: auto; border: 1px solid #ead9c9; border-radius: 16px; background: #fff8ef; color: var(--ink); box-shadow: var(--shadow-lg); }
.reception-editor::backdrop { background: rgba(69,65,58,.2); backdrop-filter: blur(9px); }
.editor-empty { min-height: 365px; display: grid; place-items: center; align-content: center; text-align: center; }
.empty-monogram { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 20px; border: 1px solid #e3c8bd; border-radius: 50%; color: var(--red); background: rgba(255,255,255,.52); font-family: "Songti TC", Georgia, serif; font-size: 25px; }
.editor-empty h2 { margin-bottom: 10px; }
.editor-empty p { color: var(--muted); font-size: 11px; line-height: 1.7; }
.selected-guest-header { display: flex; align-items: center; gap: 14px; padding-bottom: 21px; border-bottom: 1px solid #eadfd2; }
.selected-guest-copy { min-width: 0; display: flex; flex-direction: column; gap: 5px; padding-top: 0; }
.guest-avatar.large { width: 50px; height: 50px; background: var(--red-soft); color: var(--red); font-size: 18px; }
.selected-guest-header .eyebrow { color: var(--red); line-height: 1.2; }
.selected-guest-meta-row { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.selected-guest-meta-row p { flex: 0 0 auto; margin: 0; padding-bottom: 1px; color: var(--muted); font-size: 11px; line-height: 1.3; white-space: nowrap; }
.selected-guest-copy > h2 { min-width: 0; margin: 0; line-height: 1.08; }
.walkin-header { display: flex; flex-direction: column; gap: 7px; padding-bottom: 18px; border-bottom: 1px solid #eadfd2; }
.walkin-header .eyebrow { color: var(--red); }
.reception-editor .walkin-header h2 { margin: 0; line-height: 1.15; }
.reception-editor .walkin-header p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.reception-editor > form { display: flex; flex-direction: column; gap: 17px; padding: 28px; }
.reception-priority-fields { display: grid; gap: 14px; }
.reception-priority-fields .check-row { margin: 0; }
.reception-walkin-fields { display: grid; gap: 14px; }
.reception-extra-fields { border-top: 1px solid #eadfd2; }
.reception-extra-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; color: var(--muted); cursor: pointer; list-style: none; }
.reception-extra-summary::-webkit-details-marker { display: none; }
.reception-extra-summary > span { display: flex; flex-direction: column; gap: 3px; }
.reception-extra-summary strong { color: var(--ink); font-size: 11px; }
.reception-extra-summary small { color: var(--faint); font-size: 9px; }
.reception-extra-summary svg { width: 16px; height: 16px; color: var(--muted); transition: transform 180ms var(--ease-out); }
.reception-extra-summary:focus-visible { outline: 3px solid rgba(159,61,54,.14); outline-offset: 3px; border-radius: 4px; }
.reception-extra-fields[open] .reception-extra-summary { padding-bottom: 12px; border-bottom: 1px solid #eadfd2; }
.reception-extra-fields[open] .reception-extra-summary svg { transform: rotate(180deg); }
.reception-extra-body { display: grid; gap: 14px; padding-top: 14px; }
.check-row { display: flex; align-items: center; justify-content: space-between; margin: 22px 0; cursor: pointer; }
.reception-editor .check-row { margin: 4px 0; }
.check-row > span { display: flex; flex-direction: column; gap: 3px; }
.check-row strong { font-size: 12px; }
.check-row small { color: var(--faint); font-size: 9px; }
.check-row input { position: absolute; opacity: 0; pointer-events: none; }
.check-row i { position: relative; width: 38px; height: 22px; border-radius: 99px; background: #d9d0c4; box-shadow: inset 0 0 0 1px rgba(91,72,52,.06); transition: background-color 160ms ease; }
.check-row i::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: white; transition: transform 180ms var(--ease-out); }
.check-row input:checked + i { background: var(--red); }
.check-row input:checked + i::after { transform: translateX(16px); }
.reception-editor .field label { color: var(--muted); }
.reception-editor .field input { border-color: #dfd3c5; background: rgba(255,255,255,.74); color: var(--ink); }
.reception-editor .field input::placeholder { color: var(--faint); }
.money-input { display: flex; align-items: center; overflow: hidden; border: 1px solid #dfd3c5; border-radius: 7px; background: rgba(255,255,255,.74); }
.money-input:focus-within { border-color: #bf8580; box-shadow: 0 0 0 3px rgba(205,126,119,.1); }
.money-input span { padding-left: 12px; color: var(--faint); font-family: "Songti TC", Georgia, serif; font-size: 12px; }
.money-input input { border: 0 !important; box-shadow: none !important; font-family: "Songti TC", Georgia, serif; font-size: 21px; }
.guest-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 13px; }
.guest-toolbar .select-wrap { min-width: 0; }
.guest-toolbar .select-wrap select { max-width: 180px; text-overflow: ellipsis; }
.small-search { display: flex; align-items: center; gap: 9px; width: min(320px, 100%); height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.65); }
.small-search svg { width: 16px; color: var(--faint); }
.small-search input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; font-size: 12px; }
.small-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.select-wrap { position: relative; }
.select-wrap select { height: 40px; min-width: 125px; padding: 0 31px 0 12px; appearance: none; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: rgba(255,255,255,.65); color: var(--ink); font-size: 11px; cursor: pointer; }
.select-wrap svg { position: absolute; right: 9px; top: 13px; width: 14px; height: 14px; color: var(--faint); pointer-events: none; }
.guest-summary { margin-left: auto; color: var(--muted); font-size: 11px; }
.table-wrap { position: relative; overflow: auto; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,253,249,.8); box-shadow: var(--shadow-sm); }
.guest-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.guest-table th { height: 42px; padding: 0 17px; border-bottom: 1px solid var(--line); background: rgba(237,232,223,.48); color: var(--faint); font-size: 9px; letter-spacing: .09em; text-align: left; text-transform: uppercase; }
.guest-sort-button { display: inline-flex; align-items: center; gap: 6px; width: 100%; min-height: 42px; padding: 0; border: 0; border-radius: 4px; background: transparent; font-weight: inherit; letter-spacing: inherit; text-align: left; white-space: nowrap; cursor: pointer; }
.guest-sort-heading[aria-sort] .guest-sort-button, .guest-sort-button:hover { color: var(--red); }
.guest-sort-button:focus-visible { outline: 3px solid rgba(159,61,54,.3); outline-offset: 2px; }
.guest-sort-indicator { font-size: 13px; letter-spacing: 0; }
.guest-table td { height: 66px; padding: 9px 17px; border-bottom: 1px solid var(--line-soft); font-size: 11px; }
.guest-table tr:last-child td { border-bottom: 0; }
.table-guest { display: flex; align-items: center; gap: 11px; min-width: 190px; }
.table-guest .guest-avatar { width: 34px; height: 34px; flex: 0 0 auto; }
.table-guest-meta { display: none; }
.table-guest strong { display: block; font-size: 12px; }
.table-guest span, .muted-cell { color: var(--muted); font-size: 9px; }
.money-cell { font-family: "Songti TC", Georgia, serif; font-size: 12px !important; }
.table-number { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border: 1px solid #ded5c8; border-radius: 99px; background: #f8f2e9; color: #6f685f; font-size: 10px; white-space: nowrap; }
.table-number.is-empty { border-style: dashed; background: transparent; color: var(--faint); }
.table-actions { display: flex; justify-content: flex-end; gap: 3px; }
.table-action { display: grid; place-items: center; width: 31px; height: 31px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; transition: transform 130ms var(--ease-out), background-color 160ms ease, color 160ms ease; }
.table-action svg { width: 15px; height: 15px; }
.table-empty { min-height: 280px; }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .75fr); gap: 20px; align-items: start; }
.settings-form { display: flex; flex-direction: column; gap: 19px; }
.settings-form .panel-heading { margin-bottom: 3px; }
.file-column { display: flex; flex-direction: column; gap: 13px; }
.file-card { display: flex; flex-direction: column; text-align: center; }
.file-card .file-icon { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 18px; border-radius: 50%; background: var(--red-soft); color: var(--red); }
.file-card h2 { margin: 7px 0 9px; }
.file-card p { margin-bottom: 20px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.file-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: auto; }

.field, .field-grid { min-width: 0; }
.field-grid { display: grid; gap: 14px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { color: var(--muted); font-size: 10px; font-weight: 700; }
.field label span { color: var(--faint); font-weight: 400; }
.field input, .field textarea { width: 100%; min-width: 0; max-width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: rgba(255,255,255,.7); color: var(--ink); transition: border-color 160ms ease, box-shadow 160ms ease; }
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus { border-color: #b77b75; box-shadow: 0 0 0 3px rgba(159,61,54,.08); }

.welcome { position: relative; min-height: 100vh; display: grid; place-items: center; overflow: hidden; padding: 50px 24px; background: radial-gradient(circle at 50% 35%, #fffdf8 0, #faf4e9 48%, #f3ecdf 100%); color: var(--ink); }
.welcome::before, .welcome::after { content: ""; position: absolute; width: 420px; height: 420px; border: 1px solid rgba(166,95,84,.11); border-radius: 50%; }
.welcome::before { left: -210px; top: -160px; box-shadow: 0 0 0 80px rgba(166,95,84,.025), 0 0 0 160px rgba(166,95,84,.012); }
.welcome::after { right: -250px; bottom: -200px; box-shadow: 0 0 0 80px rgba(113,140,124,.025), 0 0 0 160px rgba(113,140,124,.012); }
.welcome-brand { position: absolute; left: 34px; top: 28px; display: flex; align-items: center; gap: 10px; z-index: 1; }
.welcome-brand strong { font-family: "Songti TC", Georgia, serif; letter-spacing: .13em; }
.welcome-card { position: relative; z-index: 1; max-width: 610px; text-align: center; }
.welcome-ornament { display: grid; place-items: center; width: 78px; height: 78px; margin: 0 auto 25px; border: 1px solid rgba(220,171,164,.36); border-radius: 50%; color: #d69a94; font-family: "Songti TC", Georgia, serif; font-size: 29px; }
.welcome-card .eyebrow { color: #c5847e; }
.welcome-card h1 { margin: 18px 0; font-size: clamp(35px, 5vw, 54px); line-height: 1.3; letter-spacing: -.04em; }
.welcome-card > p { max-width: 480px; margin: 0 auto; color: var(--muted); font-size: 13px; line-height: 1.8; }
.welcome-actions { display: flex; justify-content: center; gap: 10px; margin-top: 31px; }
.welcome-actions .button { white-space: nowrap; }
.welcome-sync-state { margin-top: 18px; }
.device-list { display: grid; gap: 8px; width: 100%; text-align: left; }
.device-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); font-size: 12px; }
.device-row-main { min-width: 0; flex: 1; }
.device-name-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.device-name-label { min-width: 0; overflow-wrap: anywhere; }
.device-row small { display: block; color: var(--muted); margin-top: 3px; }
.device-row-actions { display: flex; align-items: center; justify-content: flex-end; flex: 0 0 auto; min-width: 76px; }
.device-row-actions .button { min-height: 35px; padding: 0 10px; font-size: 10px; white-space: nowrap; }
.device-name-editor { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.device-name-input { min-width: 0; flex: 1; min-height: 35px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: var(--surface-raised); color: var(--ink); font-size: 11px; }
.device-name-input:focus { border-color: #b77b75; box-shadow: 0 0 0 3px rgba(159,61,54,.08); }
.device-name-editor .button { flex: 0 0 auto; min-height: 35px; padding: 0 10px; font-size: 10px; }
.device-name-error { flex-basis: 100%; margin-top: 0 !important; color: var(--red) !important; font-size: 9px !important; }
.pairing-code-panel { display: grid; justify-items: center; gap: 6px; width: 100%; padding: 15px 16px 14px; border: 1px solid #e4c5bd; border-radius: 10px; background: linear-gradient(145deg, #fffaf6, #fdf0ec); text-align: center; }
.pairing-code-panel .eyebrow { color: var(--red); }
.pairing-code-value { color: var(--red); font-family: Georgia, "Times New Roman", serif; font-size: 34px; font-weight: 700; letter-spacing: .18em; line-height: 1.1; }
.pairing-code-panel p { margin: 0; color: var(--muted); font-size: 11px; }
.pairing-code-panel small { color: var(--faint); font-size: 10px; }
.welcome .button-secondary { border-color: var(--line); background: rgba(255,255,255,.62); color: var(--ink); box-shadow: var(--shadow-sm); }
.welcome-trust { display: flex; justify-content: center; gap: 24px; margin-top: 34px; color: var(--faint); font-size: 9px; }
.welcome-trust span { display: flex; align-items: center; gap: 6px; }
.welcome-trust i { width: 4px; height: 4px; border-radius: 50%; background: var(--green); }

.dialog { width: min(520px, calc(100vw - 30px)); max-height: calc(100vh - 40px); margin: auto; padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); opacity: 1; transform: scale(1); transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out), overlay 180ms allow-discrete, display 180ms allow-discrete; }
.dialog[open] { opacity: 1; transform: scale(1); }
.dialog { overscroll-behavior: contain; }
@starting-style { .dialog[open] { opacity: 0; transform: scale(.97); } }
.dialog::backdrop { background: rgba(89,75,61,.24); backdrop-filter: blur(3px); opacity: 1; transition: opacity 180ms ease, overlay 180ms allow-discrete, display 180ms allow-discrete; }
@starting-style { .dialog[open]::backdrop { opacity: 0; } }
.dialog > form { position: relative; display: flex; flex-direction: column; gap: 17px; padding: 28px; }
.dialog-close { position: absolute; right: 17px; top: 17px; z-index: 2; background: var(--paper); }
.dialog h2 { margin-top: -8px; font-size: 26px; }
.dialog h2 + p { margin: -10px 0 2px; color: var(--muted); font-size: 11px; }
.reception-editor .selected-guest-copy { gap: 5px; padding-top: 0; }
.reception-editor .selected-guest-copy > h2 { margin: 0; font-size: 22px; line-height: 1.2; }
.reception-editor .selected-guest-meta-row p { margin: 0; font-size: 11px; line-height: 1.4; }
.confirm-dialog { width: min(390px, calc(100vw - 30px)); text-align: center; }
.pair-dialog { width: min(350px, calc(100vw - 30px)); }
.pair-dialog > form { gap: 15px; padding: 24px; }
.pair-dialog .pair-dialog-heading { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.pair-dialog .pair-dialog-heading h2 { margin: 0; font-size: 22px; line-height: 1.2; }
.pair-dialog .pair-dialog-heading p { max-width: 270px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.confirm-dialog .pair-code-field { width: 100%; }
.confirm-dialog #pair-code { text-align: center; }
.confirm-dialog .dialog-error { width: 100%; margin: -5px 0 0; padding: 9px 11px; border: 1px solid #e4c5bd; border-radius: 7px; background: var(--red-soft); color: var(--red); font-size: 11px; line-height: 1.5; text-align: left; }
.confirm-dialog > form { align-items: center; }
.confirm-icon { display: grid; place-items: center; width: 45px; height: 45px; border-radius: 50%; background: var(--red-soft); color: var(--red); font-family: Georgia, serif; font-weight: 700; }
.confirm-dialog h2 { margin: 0; font-size: 22px; }
.confirm-dialog h2 + p { max-width: 310px; margin: -7px 0 5px; line-height: 1.6; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; max-width: min(360px, calc(100vw - 32px)); padding: 12px 15px; border: 1px solid var(--line); border-radius: 8px; background: #fffdf8; color: var(--ink); box-shadow: 0 12px 30px rgba(91,72,52,.14); font-size: 11px; opacity: 1; transform: translateY(0); transition: opacity 180ms ease, transform 180ms var(--ease-out); }
.toast::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #7ca286; }
.toast.is-error::before { background: #d87970; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); }
@starting-style { .toast { opacity: 0; transform: translateY(8px); } }
.sidebar-backdrop { display: none; }

@keyframes wedding-spin { to { transform: rotate(360deg); } }
@keyframes sync-pulse { 0%, 100% { opacity: .45; transform: scale(.84); } 50% { opacity: 1; transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .button.is-loading::before, .sync-state.is-saving i, .initializing-spinner { animation: none; }
}

@media (hover: hover) and (pointer: fine) {
  .nav-item:hover { background: #f8eee5; color: var(--red-dark); }
  .button-primary:hover { background: var(--red-dark); box-shadow: 0 6px 16px rgba(143,79,70,.22); }
  .button-secondary:hover { border-color: #c9c1b5; background: white; }
  .icon-button:hover, .table-action:hover { background: var(--paper-deep); color: var(--ink); }
  .result-row:hover { border-color: #cfc5b9; background: var(--surface-raised); }
  .table-action.danger:hover { background: var(--red-soft); color: var(--red); }
  .text-button:hover { color: var(--red-dark); }
}

@media (min-width: 981px) {
  .settings-grid { align-items: stretch; }
  .file-card { height: 100%; }
}

@media (max-width: 980px) {
  :root { --sidebar: 224px; }
  .topbar, .content { padding-left: 28px; padding-right: 28px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-primary { grid-column: 1 / -1; }
  .dashboard-grid, .reception-layout { grid-template-columns: 1fr; }
  .reception-editor { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
  .reception-layout.is-editing .reception-search-area { display: none; }
  .editor-empty { min-height: 220px; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { width: min(290px, calc(100vw - 46px)); transform: translateX(-100%); transition: transform 220ms var(--ease-out); box-shadow: 18px 0 50px rgba(91,72,52,.15); }
  body.menu-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 15; display: block; background: rgba(89,75,61,.24); opacity: 0; pointer-events: none; transition: opacity 180ms ease; }
  body.menu-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .main-column { width: 100%; }
  .topbar { height: 66px; padding: 0 17px; }
  .icon-button.mobile-menu { display: grid; margin-right: 9px; }
  .topbar-title { margin-right: auto; }
  .topbar-actions { gap: 10px; }
  .content { padding: 28px 17px 50px; }
  .hero-row, .section-heading { align-items: flex-start; flex-direction: column; margin-bottom: 25px; }
  .hero-row .button, .section-heading .button { width: 100%; }
  .guest-heading-actions { width: 100%; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-primary { grid-column: auto; }
  .metric-card { min-height: 160px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .recent-row { grid-template-columns: 38px minmax(0, 1fr) auto; }
  .reception-heading { flex-direction: row; align-items: center; }
  .today-counter { flex: 0 0 auto; }
  .reception-search-toolbar { position: sticky; top: 66px; z-index: 5; grid-template-columns: 1fr; gap: 8px; margin: 0 -17px; padding: 8px 17px 9px; border-bottom: 1px solid var(--line-soft); background: rgba(248,244,236,.94); backdrop-filter: blur(12px); }
  .reception-add-button { width: 100%; min-width: 0; }
  .search-meta span:last-child, kbd { display: none; }
  .result-row { grid-template-columns: 42px minmax(0, 1fr) auto; }
  .result-row .status-pill { display: none; }
  .guest-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
  .small-search { grid-column: 1 / -1; width: auto; min-width: 0; }
  .small-search input { font-size: 16px; }
  .select-wrap select { min-width: 112px; }
  .guest-toolbar .select-wrap select { width: 100%; min-width: 0; max-width: none; font-size: 16px; }
  .guest-summary { grid-column: 1 / -1; width: auto; margin-left: 0; font-size: 10px; }
  .table-wrap { overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .guest-table { display: block; min-width: 0; }
  .guest-table thead { display: block; margin-bottom: 8px; }
  .guest-table tbody { display: grid; gap: 8px; }
  .guest-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0 6px; min-height: 0; padding: 11px 9px 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,253,249,.8); box-shadow: var(--shadow-sm); }
  .guest-table thead tr { display: flex; gap: 8px; padding: 0; border: 0; background: transparent; box-shadow: none; }
  .guest-table th { display: none; }
  .guest-table th.guest-sort-heading { display: block; height: auto; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 11px; }
  .guest-table td { display: none; height: auto; padding: 0; border: 0; }
  .guest-table td:first-child { display: block; min-width: 0; }
  .guest-table td:last-child { display: block; grid-column: 2; grid-row: 1; align-self: center; }
  .table-guest { gap: 9px; min-width: 0; }
  .table-guest .guest-avatar { width: 32px; height: 32px; }
  .table-guest > span:last-child { min-width: 0; }
  .table-guest strong, .table-guest > span:last-child > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .table-guest-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin: 5px 0 0 41px; color: var(--muted); font-size: 9px; line-height: 1.3; }
  .table-guest-meta .status-pill { padding: 3px 6px; font-size: 8px; }
  .table-guest-meta .status-pill::before { width: 4px; height: 4px; }
  .table-guest-gift { font-family: "Songti TC", Georgia, serif; }
  .table-actions { gap: 1px; }
  .table-action { width: 29px; height: 29px; }
  .file-column { display: flex; }
  .field-grid.two { grid-template-columns: 1fr; }
  .welcome-actions { flex-direction: column; }
  .welcome-sync-state { margin-top: 16px; }
  .topbar-device { min-height: 35px; padding: 0 9px; }
  .welcome-trust { gap: 12px; }
}

/* iOS WebKit miscalculates 100%-wide date inputs when author padding is nonzero. */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 720px) {
    .field input[type="date"] { height: 42px; min-height: 42px; padding: 0; }
  }
}

@media (max-width: 430px) {
  .topbar-title .eyebrow { display: none; }
  .reception-heading { align-items: flex-start; }
  .today-counter { padding: 8px 0 8px 13px; }
  .welcome-brand { left: 22px; top: 20px; }
  .welcome-card h1 { font-size: 34px; }
  .welcome-trust { flex-wrap: wrap; }
  .dialog > form { padding: 25px 21px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
