
/* ===== Shared Form / Table / Card Primitives =====
   Added 2026-09-08. These class names were already used in the markup —
   chiefly `pages/campaigns_page/` (mounted by the admin page's Campaigns
   section), plus `event_summary.rs`, `admin_deposit_record_slip.rs` and
   `event_form/` — but had no rules at all, so the elements rendered at
   browser defaults. `tests/css_class_audit.rs` guards against that recurring.

   Deliberately generic: several of these are shared across pages, so they use
   the same tokens and metrics as the existing `.form-input`, `.card` and
   `.badge` rules rather than introducing a parallel vocabulary. */

/* --- Forms --- */
.form-group {
    margin-bottom: 1rem;
}

.form-group-sm {
    margin-bottom: 0.6rem;
}

.form-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-label-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.form-row > .form-group {
    flex: 1 1 12rem;
}

/* Mirrors .form-input so inputs and selects align on the same row. */
.form-select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
    outline: none;
    box-sizing: border-box;
    cursor: pointer;
}

.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 92, 57, 0.15);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.form-advanced {
    margin-top: 0.75rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.form-advanced-summary {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    list-style: none;
}

.form-advanced-summary:hover {
    color: var(--text-primary);
}

/* --- Tables --- */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.table th,
.table td {
    padding: 0.55rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table-header th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    white-space: nowrap;
}

.table-row {
    transition: background 0.15s ease;
}

.table-row:hover {
    background: var(--bg-hover);
}

.table-row:last-child td {
    border-bottom: none;
}

/* --- Card internals ---
   `.card` already supplies padding, so `.card-body` is a content wrapper
   rather than a second padded box. */
.card-body {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.card-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.card-header-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-top: 0.6rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* --- Status dot --- */
.status-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.status-dot-loading {
    background: var(--accent);
    animation: dep2-dot-pulse 1.2s ease-in-out infinite;
}

/* --- Feedback (admin → Feedback section) --- */
.admin-feedback-page {
    padding-bottom: 3rem;
}

/* --- Campaigns (admin → Campaigns section) --- */
.admin-campaigns-page {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.campaigns-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.campaign-detail-info {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.campaign-detail-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.campaign-detail-row strong {
    color: var(--text-primary);
    font-weight: 600;
    min-width: 7rem;
}

/* Organizer notification delivery history */
.notification-panel { margin-top: 1rem; }
.notification-panel-body { margin-top: .75rem; padding: 1rem; border: 1px solid var(--border); border-radius: .75rem; }
.notification-panel-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }
.notification-table-scroll { overflow-x: auto; }
.notification-table { width: 100%; min-width: 42rem; border-collapse: collapse; text-align: left; }
.notification-table th, .notification-table td { padding: .65rem; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }

.notification-table th { white-space: nowrap; }
.notification-table td:first-child { min-width: 12rem; }
.notification-scroll-hint { display: none; font-size: .875rem; }
@media (max-width: 767px) {
  .notification-scroll-hint { display: block; }
}

/* Verified-attendee D1 inbox */
.attendee-inbox { margin-top: 1.5rem; }
.attendee-inbox-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.attendee-inbox-summary { margin: .25rem 0 0; color: var(--text-secondary); font-size: .875rem; }
.attendee-inbox-list { display: grid; gap: .65rem; }
.attendee-inbox-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; border: 1px solid var(--border); border-radius: .75rem; background: var(--bg-card); }
.attendee-inbox-item--unread { border-left: 3px solid var(--accent, #14f195); }
.attendee-inbox-copy h3 { margin: .15rem 0; font-size: 1rem; }
.attendee-inbox-copy p { margin: 0; color: var(--text-secondary); font-size: .875rem; }
.attendee-inbox-event { color: var(--text-muted); font-size: .75rem; }
.attendee-inbox-actions { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
@media (max-width: 767px) {
  .attendee-inbox-item { align-items: stretch; flex-direction: column; }
  .attendee-inbox-actions { justify-content: flex-end; }
}

/* Postponed notice (migration 0053) — one banner shared by the public event
   page and both ticket views (`components::postponed_banner`). Warning tokens,
   the same family as `.badge-warning` on the event cards. `pre-wrap` is the
   whole line-break contract: the component emits a text node, never <br>. */
.postponed-banner {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--warning-border);
    border-left: 3px solid var(--warning);
    border-radius: 0.75rem;
    background: var(--warning-bg);
}
.postponed-banner-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--warning);
}
.postponed-banner-body {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-primary);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* EN ⇄ TH switch on attendee pages (.plans/037 §2). In the flow above the
   page, not fixed: every fixed corner is taken by a sticky CTA, submit bar or
   nav on some attendee page. */
.lang-bar {
    display: flex;
    justify-content: flex-end;
    max-width: 1120px;
    margin: 0 auto;
    /* Off the top edge, so the chip does not read as clipped (QA item 6). */
    padding: 6px 12px 2px;
}

/* The button keeps a 44 px tap target; the chip inside is what is drawn. */
.lang-switch {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font: inherit;
    font-size: var(--text-sm);
    cursor: pointer;
}

.lang-switch-chip {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    line-height: 1.3;
}

.lang-switch:hover,
.lang-switch:focus-visible {
    color: var(--accent);
}

.lang-switch:hover .lang-switch-chip,
.lang-switch:focus-visible .lang-switch-chip {
    border-color: var(--accent);
}

/* Toast (components::Toast). Moved out of inline styles; same look. The
   region is always present so its `aria-live` announcements are reliable. */
.toast-region {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    max-width: 360px;
}

.toast {
    padding: 0.85rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.toast-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #22c55e;
}

.toast-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.toast-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #f59e0b;
}

.toast-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #3b82f6;
}

/* Turnstile bot check (.issues/170). No space until the widget renders, so a
   deployment without Turnstile has no layout shift. */
.bot-check-slot.is-on {
    min-height: 65px;
    margin: 12px 0;
}

/* First-visit privacy notice (.plans/038 P2-d). Fixed, so it never shifts
   the page; above the event page's sticky CTA until dismissed. */
.privacy-notice {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    /* Above the event page's sticky CTA (z-index 60, later in the DOM). */
    z-index: 70;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 40rem;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.privacy-notice-text {
    flex: 1;
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.privacy-notice-ok {
    flex-shrink: 0;
    min-height: 44px;
}

/* While the notice shows, leave room under the page so the last control
   (the registration form's submit button) can scroll clear of it instead
   of hiding behind it until the notice is dismissed. */
body:has(.privacy-notice) {
    padding-bottom: calc(7rem + env(safe-area-inset-bottom, 0px));
}

/* Marketing emails on the profile (.plans/038 P2-e). */
.marketing-pref {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 1.25rem 0;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.marketing-pref-title {
    font-size: 1rem;
    margin: 0;
}

.marketing-pref-state {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.marketing-pref-more {
    font-size: 0.85rem;
}

/* /faq (.plans/038 P3-a): two tabs of native <details> accordions. */
.faq-page {
    max-width: 44rem;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 4rem;
}

.faq-back {
    font-size: 0.9rem;
}

.faq-title {
    margin: 1rem 0;
}

.faq-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.faq-tab {
    flex: 1;
    min-height: 44px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    cursor: pointer;
}

.faq-tab--active {
    color: var(--text-primary);
    border-color: var(--accent);
    background: var(--accent-bg);
}

.faq-panel {
    display: flex;
    flex-direction: column;
}

.faq-item {
    border-bottom: 1px solid var(--border);
    padding: 0.25rem 0;
}

.faq-q {
    min-height: 44px;
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
}

.faq-a {
    margin: 0 0 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* /sandbox (.plans/042 0.4): the deposit loop on devnet, one step at a time. */
.sandbox-page {
    max-width: 40rem;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 4rem;
}

.sandbox-badge {
    display: block;
    width: fit-content;
    margin-top: 1rem;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--warning-border);
    border-radius: 999px;
    background: var(--warning-bg);
    color: var(--warning);
    font-size: 0.8rem;
    font-weight: 600;
}

.sandbox-title {
    margin: 0.75rem 0 0.5rem;
}

.sandbox-subtitle,
.sandbox-note,
.sandbox-fineprint {
    color: var(--text-secondary);
    line-height: 1.6;
}

.sandbox-fineprint {
    font-size: 0.85rem;
    margin-top: 2rem;
}

.sandbox-wallet code {
    font-size: 0.9rem;
}

.sandbox-steps {
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sandbox-step {
    display: flex;
    gap: 0.875rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
}

.sandbox-step--current {
    border-color: var(--accent-border);
    background: var(--accent-bg);
}

.sandbox-step--later {
    opacity: 0.55;
}

.sandbox-step-num {
    flex: none;
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--border);
    font-weight: 700;
}

.sandbox-step--done .sandbox-step-num {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success-bright);
}

.sandbox-step-body {
    flex: 1;
    min-width: 0;
}

.sandbox-step-title {
    margin: 0.2rem 0 0.25rem;
    font-size: 1.05rem;
}

.sandbox-step-hint {
    margin: 0 0 0.5rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.sandbox-countdown {
    margin: 0 0 0.5rem;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.sandbox-action {
    min-height: 44px;
    margin-top: 0.25rem;
}

.sandbox-tx {
    display: inline-block;
    margin-top: 0.25rem;
    font-size: 0.9rem;
}

.sandbox-error {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--danger-border);
    border-radius: var(--radius-sm);
    background: var(--danger-bg);
    color: var(--danger-bright);
}

.sandbox-off {
    margin-top: 1.5rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-secondary);
}

.sandbox-done {
    margin-top: 1.5rem;
    padding: 1rem;
    border: 1px solid var(--success-border);
    border-radius: var(--radius);
    background: var(--success-bg);
}

.sandbox-restart {
    margin-top: 1rem;
    min-height: 44px;
}

/* /sandbox: which wallet signs (test wallet or the visitor's own, on devnet). */
.sandbox-signer {
    margin-top: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sandbox-signer-title {
    width: 100%;
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.sandbox-signer-opt {
    min-height: 44px;
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    cursor: pointer;
}

.sandbox-signer-opt--on {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.sandbox-signer .sandbox-note,
.sandbox-signer .sandbox-fineprint {
    width: 100%;
    margin: 0.25rem 0 0;
}
