/* Shared mobile app shell. Desktop retains its full navigation and data tables. */
.mobile-tabs, .mobile-profile, .mobile-people { display: none; }
.mobile-more { max-height: 85dvh; overflow-y: auto; }
.mobile-more-head { display: flex; justify-content: space-between; align-items: center; padding: 24px 22px 12px; }
.mobile-more-head h2 { font-size: 1.6rem; margin: 0; }
.mobile-eyebrow { display: block; font-size: 10px; font-weight: 700; letter-spacing: .14em; color: var(--muted); margin-bottom: 4px; }
.mobile-more-links { padding: 0 12px; }
.mobile-more-links a { display: flex; flex-direction: column; padding: 14px 12px; color: var(--text); border-bottom: 1px solid var(--line); border-radius: 10px; }
.mobile-more-links a:hover, .mobile-more-links a[aria-current] { background: var(--surface-50); text-decoration: none; }
.mobile-more-links span { color: var(--muted); font-size: 12px; }
.mobile-signout { padding: 18px 22px; }
.scanner-heading { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 16px; }
.scanner-heading-icon { display: grid; place-items: center; width: 48px; height: 48px; background: var(--surface-50); border-radius: 16px; color: var(--brand); }
.scanner-heading-icon .nav-icon { display: block; width: 26px; height: 26px; }
.manual-label { font-size: 12px; font-weight: 600; color: var(--muted); margin: 16px 0 8px; }
button, a, input, select, summary { touch-action: manipulation; }
[hidden] { display: none !important; }

@media (max-width: 880px) and (hover: none) and (pointer: coarse) {
    :root { --bg: #FAF8F3; --radius: 16px; }
    html { scroll-padding-top: 80px; scroll-padding-bottom: 100px; }
    body { font-family: var(--font-body); }
    .app-shell { padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px)); }
    main { padding: 24px 18px 32px; }
    .topbar { padding-top: env(safe-area-inset-top, 0px); box-shadow: none; }
    .topbar-inner { min-height: 62px; flex-wrap: nowrap; justify-content: space-between; padding: 8px 18px; }
    .brand-logo img.logo { height: 35px; max-width: 185px; }
    .topbar .menu-toggle, .topbar .mainnav { display: none; }
    .mobile-profile { display: grid; place-items: center; width: 44px; height: 44px; }
    .mobile-profile .avatar { width: 36px; height: 36px; background: var(--surface-50); color: var(--brand); border: 1px solid var(--accent); }
    .eventbar { background: #fff; }
    .eventbar-inner { padding: 0 16px 12px; gap: 8px; }
    .event-switch { flex: 1 1 100%; border: 1px solid var(--line); background: var(--surface-50); border-radius: 12px; padding: 2px 10px; }
    .event-switch select { min-height: 42px; font-size: 14px; }
    .eventbar-state { padding-left: 3px; }
    .eventbar-state .badge { background: transparent; padding: 0; font-size: 10px; text-transform: none; letter-spacing: 0; }
    .mobile-tabs { position: fixed; z-index: 50; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 8px max(8px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 24px rgba(11, 58, 36, .05); }
    .mobile-tab { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; min-height: 52px; color: #8A7F78; font: inherit; font-family: var(--font-head); font-size: 10px; font-weight: 600; border: 0; background: transparent; border-radius: 14px; cursor: pointer; text-decoration: none; }
    .mobile-tab:hover { text-decoration: none; background: var(--surface-50); }
    .mobile-tab .nav-icon { display: block; width: 23px; height: 23px; }
    .mobile-tab.is-active { color: var(--brand); background: var(--surface-50); box-shadow: inset 0 -2px 0 var(--accent); }
    .mobile-tab.scan-tab { color: var(--brand); }
    .mobile-tab.scan-tab .nav-icon { padding: 8px; width: 42px; height: 36px; margin-top: -8px; border-radius: 12px; background: var(--brand); color: white; }
    .mobile-more { margin: auto auto 0; width: 100%; max-width: 600px; border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
    .mobile-more::before { content: ''; display: block; margin: 10px auto -8px; width: 36px; height: 4px; border-radius: 8px; background: var(--line-strong); }
    .grid-2, .event-grid { grid-template-columns: minmax(0, 1fr); }
    .grid-2 > *, .form-grid > *, .page-head > * { min-width: 0; }
    .page-head { gap: 14px; margin: 0 0 24px; }
    .page-head h1 { font-size: 26px; letter-spacing: 0; }
    .page-head p { font-size: 12px; line-height: 1.6; }
    .page-head .actions { width: 100%; }
    .page-head .actions .btn { flex: 1; }
    /* Save / Save & issue / Save & add another: one full-width target each, not three
       half-width ones a thumb has to aim at. */
    .form-grid .actions .btn { flex: 1 1 100%; }
    .card { padding: 20px; box-shadow: 0 2px 6px rgba(11, 58, 36, .03); border-color: var(--line); }
    .btn { min-height: 46px; border-radius: 10px; padding: 10px 16px; white-space: normal; font-size: 14px; line-height: 1.35; }
    .btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 10px rgba(0, 98, 51, .14); }
    .btn-primary:hover { background: var(--brand-700); border-color: var(--brand-700); }
    .btn-secondary { background: var(--surface-50); border-color: var(--surface); color: var(--brand-900); }
    .btn-secondary:hover { background: var(--surface); color: var(--brand-900); }
    input, select, textarea { min-height: 48px; font-size: 16px; border-radius: 10px; }
    input[type=checkbox] { min-height: 22px; width: 22px; height: 22px; flex: none; }
    label { font-size: 13px; gap: 6px; }
    label.check { min-height: 44px; }
    .form-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .form-grid .actions .btn { flex: 1 1 140px; }
    .checks { gap: 8px 20px; }
    .details { grid-template-columns: minmax(70px, 32%) minmax(0, 1fr); gap: 10px 14px; }
    .details dd, .feed, .event-card h2, .eticket .holder { overflow-wrap: anywhere; }
    .event-banner { border: 0; padding: 20px; border-radius: 18px; background: linear-gradient(112deg, var(--brand) 0 86%, var(--accent) 86% 87.2%, var(--brand-700) 87.2% 100%); padding-right: 3.2rem; gap: 12px; }
    .event-banner h1 { font-size: 24px; letter-spacing: 0; line-height: 1.3; }
    .event-banner p { font-size: 12px; line-height: 1.6; }
    .event-banner .badge { font-size: 9px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .stat { padding: 16px; border-radius: 16px; min-height: 108px; }
    .stat::before { top: 18px; bottom: auto; left: auto; right: 16px; width: 6px; height: 6px; border-radius: 50%; }
    .stat span { font-size: 11px; max-width: calc(100% - 10px); }
    .stat strong { font-size: 30px; letter-spacing: -.02em; margin: 7px 0 2px; }
    .stat em { font-size: 11px; }
    .checkin-notice { font-size: 12px; line-height: 1.5; padding: 12px 14px; align-items: flex-start; }
    main.scan-main { padding-top: 20px; }
    .scanner-heading h1 { font-size: 27px; letter-spacing: 0; }
    .scan-camera { aspect-ratio: 1.3; max-height: 36dvh; min-height: 180px; background: radial-gradient(ellipse at center, #14432C, #06180F); border-radius: 20px; }
    .scan-frame { inset: 15% 23%; border-color: var(--accent); border-width: 2px; box-shadow: none; }
    .scan-hint { font-size: 12px; }
    .scan-controls { display: flex; gap: 8px; }
    .scan-controls .btn { flex: 1; background: var(--brand); color: white; border-color: var(--brand); }
    .scan-controls select { flex: 1; width: 45%; }
    .scan-manual { display: flex; gap: 8px; }
    .scan-manual input { min-width: 0; flex: 1; font-family: ui-monospace, monospace; letter-spacing: 1px; }
    .scan-result { border-radius: 18px; scroll-margin-bottom: 90px; }
    .scan-result.idle { padding: 18px; background: #fff; }
    .scan-result.idle .scan-title { font-size: 16px; }
    .scan-result .actions .btn { flex: 1; min-height: 50px; }
    .scan-sub { font-size: 13px; }
    .attendee-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px; }
    /* 16px keeps iOS from zooming into the field when it is focused; the taller box is
       sized for a thumb. The browser's own clear (X) is left alone. */
    .attendee-filters input[type=search] { grid-column: 1 / -1; font-size: 16px; min-height: 48px; }
    .attendee-filters select { width: 100%; font-size: 16px; }
    .attendee-filters .linkish { min-height: 44px; display: grid; place-items: center; }
    .desktop-people { display: none; }
    .mobile-people { display: grid; gap: 14px; }
    .person-card { display: grid; grid-template-columns: 42px minmax(0, 1fr) 12px; gap: 12px; background: white; color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
    .person-card:hover { text-decoration: none; border-color: var(--line-strong); }
    .person-card:active { background: var(--surface-50); }
    .person-avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--surface-50); color: var(--brand); font-family: var(--font-head); font-size: 13px; font-weight: 600; border: 1px solid var(--accent); }
    .person-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
    .person-main strong { font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
    .person-meta { color: var(--muted); font-size: 11px; }
    .person-contact { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; font-weight: 400; }
    .person-chevron { color: #A39A92; font-size: 24px; align-self: center; }
    .person-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; grid-column: 1 / -1; padding-top: 12px; border-top: 1px solid var(--line); }
    .person-footer > :last-child { margin-left: auto; }
    .person-footer code { background: transparent; color: var(--muted); font-size: 11px; padding: 0; }
    .person-footer .badge { font-size: 9px; }
    .pager { margin-top: 18px; font-size: 12px; justify-content: space-between; }
    .modal { max-height: 85dvh; overflow: auto; }
    .modal-body { padding: 22px; }
    .auth-fields input[type=email], .auth-fields input[type=password] { min-height: 52px; }
    .auth-fields .btn-lg { min-height: 54px; }
    .table-wrap { max-width: 100%; overscroll-behavior-x: contain; }
    .table-wrap th { white-space: nowrap; }
    .bar-row { grid-template-columns: minmax(65px, 100px) minmax(0, 1fr) 35px; }
    .inline-form select { max-width: 100%; }
}
/* A narrow desktop window keeps desktop navigation and tabular data. */
@media (max-width: 880px) and (hover: hover) {
    main { width: 100%; padding: 24px 18px 32px; }
    .grid-2, .event-grid { grid-template-columns: minmax(0, 1fr); }
    .grid-2 > *, .page-head > * { min-width: 0; }
    .table-wrap { max-width: 100%; }
    .topbar-inner { flex-wrap: wrap; }
    .mainnav { max-height: 60vh; overflow-y: auto; }
    .event-switch { width: 100%; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .details dd { overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media print {
    .mobile-tabs, .mobile-profile, .mobile-more, .mobile-people, .eventbar { display: none !important; }
    .desktop-people { display: block; }
    .app-shell { padding-bottom: 0; }
}
