:root {
    --primary: #ff0028;
    --primary-dark: #d90024;
    --soft: #fce7eb;
    --border: #eed6db;
    --text: #292329;
    --muted: #8f858b;
    --text-secondary: #71666c;
    --surface: #ffffff;
    --canvas: #fff9fa;
    --line: #f2e9eb;
    --success: #19754d;
    --warning: #9a5d00;
    --danger: #b4233b;
    --radius-card: 20px;
    --radius-input: 12px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --shadow-float: 0 16px 44px rgba(55, 26, 35, .14), 0 3px 10px rgba(55, 26, 35, .05);
    --font-sans: "Google Sans", "Noto Sans Thai", Tahoma, sans-serif;
}

* { box-sizing: border-box; }
.fi { display: inline-block; line-height: 1; }
.icon-credit { margin-top: var(--space-4); color: var(--text-secondary); font-size: 11px; text-align: center; padding-bottom: var(--space-3); }
.auth-card .icon-credit { padding-bottom: 0; }
.icon-credit a { text-decoration: underline; text-underline-offset: 2px; }
.btn-close.app-modal-close { display: grid; place-items: center; background: none; }
.swal2-icon-content .fi { font-size: .78em; }
html { scroll-behavior: smooth; }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--canvas);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
    outline: 3px solid rgba(255, 0, 40, .3);
    outline-offset: 2px;
}

.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    width: 250px;
    padding: 26px 16px 18px;
    background: var(--surface);
    border-right: 1px solid var(--line);
}
.brand-mark { display: inline-flex; align-items: center; gap: 11px; color: var(--text); font-size: 18px; font-weight: 700; }
.brand-mark-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #fff;
    background: var(--primary);
    border-radius: 13px;
    box-shadow: 0 7px 16px rgba(255, 0, 40, .2);
    font-size: 18px;
}
.workspace-label { margin: 46px 12px 10px; color: #a79da2; font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.side-nav { display: grid; gap: 5px; }
.side-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    width: 100%;
    padding: 0 12px;
    color: #736a70;
    background: transparent;
    border: 0;
    border-radius: 11px;
    text-align: left;
    transition: color .15s ease, background .15s ease;
}
.side-link i { width: 19px; font-size: 17px; }
.side-link:hover { color: var(--primary); background: #fff5f6; }
.side-link.active { color: var(--primary-dark); background: var(--soft); font-weight: 600; }
.sidebar-bottom { display: grid; gap: 14px; margin-top: auto; }
.sidebar-note { display: flex; gap: 9px; align-items: flex-start; padding: 12px; color: #796e74; background: #fff9fa; border: 1px solid var(--line); border-radius: 12px; font-size: 12px; }
.sidebar-note i { color: var(--primary); font-size: 15px; }
.side-logout { min-height: 42px; }
.main-area { min-height: 100vh; margin-left: 250px; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 90px;
    padding: 15px clamp(22px, 4vw, 58px);
    background: rgba(255, 249, 250, .94);
    border-bottom: 1px solid rgba(238, 214, 219, .58);
    backdrop-filter: blur(12px);
}
.eyebrow { margin: 0 0 4px; color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.topbar-title h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.025em; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user strong, .topbar-user small { display: block; }
.topbar-user strong { font-size: 13px; font-weight: 600; }
.topbar-user small { color: var(--text-secondary); font-size: 11px; }
.avatar { display: grid; width: 38px; height: 38px; place-items: center; color: var(--primary-dark); background: var(--soft); border: 1px solid #f3cbd4; border-radius: 50%; font-weight: 700; }
.mobile-menu-button { display: none; border: 0; background: transparent; font-size: 24px; }
.page-content { width: min(100%, 1500px); margin: 0 auto; padding: 32px clamp(22px, 4vw, 58px) 64px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.section-heading h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.app-button, .app-button-outline, .app-button-light {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}
.btn-primary.app-button { color: #fff; background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: 0 6px 15px rgba(255, 0, 40, .16); }
.btn-primary.app-button:hover { background: #b90020; border-color: #b90020; }
.app-button-outline { color: var(--text); background: #fff; border-color: var(--border); }
.app-button-outline:hover { color: var(--primary-dark); background: #fff4f6; border-color: #e8a8b4; }
.app-button-outline:disabled { color: var(--text-secondary); background: #fff; border-color: var(--border); }
.app-button-light { color: #61575d; background: #f7f3f4; border-color: #f7f3f4; }
.swal2-container.app-toast-container { pointer-events: none; }
.swal2-container.app-toast-container .app-toast { pointer-events: auto; }
.text-link { color: var(--primary-dark); font-size: 13px; font-weight: 600; }
.text-link i { margin-left: 4px; }

.dashboard-header { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: var(--space-4); margin-bottom: 24px; }
.dashboard-header h2 { margin: 0; font-size: clamp(24px, 3vw, 32px); font-weight: 700; letter-spacing: -.025em; }
.dashboard-controls { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-3); }
.dashboard-controls .app-button, .dashboard-controls .app-button-outline { min-height: 44px; }
.dashboard-year label { display: block; margin-bottom: var(--space-1); font-size: 12px; font-weight: 600; }
.dashboard-select { position: relative; min-width: 148px; }
.dashboard-select select { min-height: 44px; padding-right: 34px; appearance: none; cursor: pointer; }
.dashboard-select .fi { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }
#dashboard-results, .dashboard-metrics { display: grid; gap: var(--space-4); }
#dashboard-results { gap: 24px; }
#dashboard-results[hidden], #dashboard-state[hidden], #events-all-years[hidden] { display: none; }
.dashboard-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dashboard-panel { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.dashboard-metric, .dashboard-chart { min-width: 0; padding: clamp(14px, 2vw, 24px); }
.dashboard-metric:nth-child(2) { background: #fff3f5; }
.dashboard-metric-heading, .dashboard-chart-heading { display: flex; align-items: center; gap: var(--space-2); }
.dashboard-metric-icon { display: grid; flex: 0 0 36px; height: 36px; place-items: center; border-radius: 10px; background: var(--soft); color: var(--primary-dark); }
.dashboard-metric h3 { margin: 0; font-size: 13px; font-weight: 600; }
.dashboard-metric p { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-2); margin: var(--space-3) 0 0; color: var(--text-secondary); font-size: 12px; }
.dashboard-metric-value { color: var(--text); font-size: clamp(24px, 4vw, 36px); font-variant-numeric: tabular-nums; line-height: 1.15; overflow-wrap: anywhere; }
.dashboard-chart h2 { margin: 0; font-size: 17px; font-weight: 700; }
.dashboard-chart-empty { padding: 24px 0 8px; margin: 0; color: var(--text-secondary); text-align: center; font-size: 13px; }
.dashboard-bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-3) var(--space-2); margin: var(--space-4) 0 0; padding: 0; list-style: none; }
.dashboard-bars-by-year { grid-template-columns: repeat(var(--buckets), minmax(68px, 1fr)); overflow-x: auto; }
.dashboard-bars li { min-width: 0; display: grid; grid-template-rows: auto 104px auto; gap: var(--space-1); text-align: center; }
.dashboard-bar-count { color: var(--text); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dashboard-bar-track { display: flex; justify-content: center; align-items: end; border-bottom: 1px solid var(--border); background: repeating-linear-gradient(to top, transparent 0, transparent calc(25% - 1px), var(--line) calc(25% - 1px), var(--line) 25%); }
.dashboard-bar-track span { height: var(--height); width: min(65%, 36px); border-radius: 5px 5px 0 0; background: var(--primary-dark); }
.dashboard-bar-label { font-size: 11px; color: var(--text-secondary); }
.section-heading { margin-bottom: 16px; }
.dashboard-list-heading { flex-wrap: wrap; gap: var(--space-3); }
.dashboard-events-button { display: inline-flex; align-items: center; gap: var(--space-2); white-space: nowrap; }
.export-buttons { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.event-list { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.event-row { display: grid; grid-template-columns: 60px minmax(0, 1fr) 150px 100px 256px; align-items: center; gap: var(--space-4); padding: 17px 21px; }
.event-main { min-width: 0; overflow-wrap: anywhere; }
.event-row + .event-row { border-top: 1px solid var(--line); }
.event-date-block { display: grid; width: 52px; height: 56px; place-content: center; color: var(--primary-dark); background: #fff3f5; border: 1px solid #f5d9df; border-radius: 13px; text-align: center; line-height: 1.1; }
.event-date-block strong { font-size: 18px; }
.event-date-block small { margin-top: 5px; font-size: 10px; }
.event-title { margin: 0; font-size: 15px; font-weight: 700; }
.event-description { max-width: 520px; margin: 4px 0 0; overflow: hidden; color: var(--text-secondary); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.event-count { font-weight: 700; }
.event-count small { display: block; margin-top: 2px; color: var(--text-secondary); font-size: 11px; font-weight: 400; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.status-pill::before { width: 6px; height: 6px; background: currentColor; border-radius: 50%; content: ""; }
.status-published { color: #19754d; background: #e9f6ef; }
.status-draft { color: #74625b; background: #f2efed; }
.status-archived { color: #847c81; background: #f1eff0; }
.event-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); }
.event-actions .event-delete-button { color: var(--danger); }
.icon-button { display: inline-grid; width: 36px; height: 36px; place-items: center; color: #675e63; background: #fff; border: 1px solid var(--border); border-radius: 11px; }
.icon-button:hover { color: var(--primary-dark); background: #fff4f6; border-color: #e8a8b4; }
.empty-state { padding: 50px 20px; color: var(--text-secondary); text-align: center; }
.empty-state .empty-icon { display: grid; width: 54px; height: 54px; margin: 0 auto 12px; place-items: center; color: var(--primary); background: var(--soft); border-radius: 17px; font-size: 22px; }
.empty-state h3 { margin: 0 0 6px; color: var(--text); font-size: 16px; }
.empty-state p { max-width: 370px; margin: 0 auto 16px; font-size: 12px; }

.list-page-heading { margin: 3px 0 20px; }
.builder-root { min-height: 60vh; }
.builder-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.builder-back { display: inline-flex; align-items: center; gap: 9px; color: #776d73; font-size: 13px; }
.builder-actions { display: flex; gap: 8px; }
.builder-layout { display: grid; grid-template-columns: minmax(330px, .85fr) minmax(400px, 1.15fr); align-items: start; gap: 22px; }
.builder-panel { padding: 21px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-card); }
.builder-panel h2 { margin: 0 0 15px; font-size: 16px; font-weight: 700; }
.panel-subheading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.field-panel-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.copy-form-panel { margin-bottom: var(--space-4); padding: var(--space-4); background: #fff8f9; border: 1px solid var(--border); border-radius: var(--radius-input); }
.copy-form-panel .field-panel-actions { justify-content: flex-end; margin-top: var(--space-3); }
#copy-form-feedback { margin-bottom: var(--space-3); color: var(--success); }
.panel-subheading h2 { margin: 0; }
.app-input, .app-textarea {
    min-height: 44px;
    padding: 10px 12px;
    color: var(--text);
    background-color: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    font-size: 13px;
}
.app-input:focus, .app-textarea:focus { border-color: #e58b9a; box-shadow: 0 0 0 3px rgba(255, 0, 40, .09); }
.app-textarea { min-height: 92px; resize: vertical; }
.form-label { margin-bottom: 6px; color: #564c52; font-size: 12px; font-weight: 600; }
.field-hint { margin: 6px 0 0; color: var(--text-secondary); font-size: 11px; }
.builder-field { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); padding: 11px 0; border-top: 1px solid var(--line); }
.field-type-icon { display: grid; width: 31px; height: 31px; place-items: center; color: var(--primary-dark); background: #fff2f4; border-radius: 10px; }
.builder-field-title { margin: 0; font-size: 13px; font-weight: 600; }
.builder-field-meta { color: #71666c; font-size: 11px; }
.field-order-actions { display: flex; gap: 4px; }
.field-order-actions button { width: 30px; height: 30px; color: #74686e; background: #fff; border: 1px solid var(--line); border-radius: 9px; }
.field-order-actions button:hover { color: var(--primary); border-color: var(--border); }
.field-order-actions button:disabled { opacity: .35; cursor: default; }
.field-edit-button { display: grid; gap: var(--space-1); min-width: 0; padding: 0; border: 0; background: transparent; overflow-wrap: anywhere; }
.privacy-note { display: flex; gap: 8px; margin-top: 14px; padding: 11px; color: #756970; background: #fff8f9; border-radius: 11px; font-size: 11px; }
.privacy-note i { color: var(--primary); }
.simple-details { margin-top: 13px; border-top: 1px solid var(--line); }
.simple-details > summary { padding: 12px 2px; color: #635960; cursor: pointer; font-size: 12px; font-weight: 600; }
.simple-details > summary::marker { color: var(--primary); }
.details-content { padding: 4px 1px 10px; }
.preview-details { margin-top: 16px; }
.preview-surface { min-height: 260px; padding: 18px; background: var(--canvas); border-radius: 14px; }
.preview-title { margin: 0 0 5px; font-size: 22px; font-weight: 700; }
.preview-description { margin: 0 0 20px; color: var(--text-secondary); font-size: 13px; white-space: pre-wrap; }
.builder-date-input { position: relative; }
.builder-date-input input { padding-right: 40px; }
.calendar-trigger { position: absolute; top: 5px; right: 5px; width: 34px; height: 34px; color: var(--primary-dark); background: #fff4f6; border: 0; border-radius: 9px; }
.date-picker-wrap { position: relative; }
.date-popover { position: absolute; z-index: 20; top: calc(100% + 7px); left: 0; width: min(316px, calc(100vw - 32px)); padding: 15px; background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-float); }
.date-picker-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.date-picker-heading strong { font-size: 13px; }
.date-picker-nav { display: flex; gap: 6px; }
.date-picker-nav button { width: 30px; height: 30px; color: #6b6066; background: #fff; border: 1px solid var(--line); border-radius: 9px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-weekday, .calendar-day { display: grid; min-height: 34px; place-items: center; font-size: 11px; }
.calendar-weekday { color: var(--text-secondary); font-weight: 600; }
.calendar-day { color: var(--text); background: transparent; border: 0; border-radius: 9px; }
.calendar-day:hover:not(:disabled) { background: #fff1f4; }
.calendar-day.selected { color: #fff; background: var(--primary); }
.calendar-day.today:not(.selected) { color: var(--primary-dark); box-shadow: inset 0 0 0 1px var(--border); }
.calendar-day.outside { color: #bdb3b8; }
.calendar-day:disabled { color: #d7cfd2; text-decoration: line-through; cursor: not-allowed; }

.filter-bar { display: flex; align-items: center; gap: 12px; margin: 0 0 15px; }
.event-filter { width: min(310px, 48%); }
.search-box { display: flex; align-items: center; gap: 9px; min-width: 190px; max-width: 360px; flex: 1; min-height: 44px; padding: 0 11px; color: var(--text-secondary); background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--text); font-size: 12px; }
.search-box kbd { padding: 2px 6px; color: #8e8288; background: #f7f2f3; border: 1px solid var(--line); border-radius: 5px; font-size: 10px; }
.table-wrap { overflow: auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-card); }
.table-scroll { overflow-x: auto; }
.table-scroll:focus-visible { outline: 2px solid var(--primary-dark); outline-offset: -3px; }
.app-table { width: 100%; margin: 0; border-collapse: collapse; white-space: nowrap; }
.app-table th { padding: 13px 14px; color: #82777d; background: #fffafb; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 600; }
.app-table td { max-width: 260px; padding: 13px 14px; overflow: hidden; border-bottom: 1px solid var(--line); font-size: 12px; text-overflow: ellipsis; }
.app-table tr:last-child td { border-bottom: 0; }
.app-table .registration-actions { width: 1%; text-align: center; }
.registration-actions .registration-delete { color: var(--danger); }
.pagination-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; color: var(--text-secondary); font-size: 11px; }
.pagination-buttons { display: flex; gap: 6px; }

.onsite-layout { display: grid; grid-template-columns: minmax(250px, .7fr) minmax(420px, 1.3fr); gap: 18px; align-items: start; }
.onsite-control-card, .onsite-qr-card { padding: 23px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-card); }
.onsite-card-icon { display: grid; width: 44px; height: 44px; margin-bottom: 15px; place-items: center; color: var(--primary); background: var(--soft); border-radius: 14px; font-size: 19px; }
.onsite-control-card h2, .onsite-qr-heading h2 { margin: 0 0 6px; font-size: 18px; }
.onsite-control-card > p, .onsite-qr-heading p { margin: 0 0 18px; color: var(--text-secondary); font-size: 12px; }
.onsite-control-card .event-filter { width: 100%; }
.onsite-control-card h2 { margin-bottom: var(--space-4); }
.onsite-note { margin-top: 15px; padding: 11px 12px; color: #72656c; background: #faf7f8; border: 1px solid var(--line); border-radius: 11px; font-size: 11px; }
.onsite-note.success { color: #276448; background: #f3fbf6; border-color: #d6ecdf; }
.onsite-note.warning { color: #805009; background: #fff9ed; border-color: #f1e0be; }
.onsite-note.error { color: #9e2d42; background: #fff4f6; border-color: #f0ccd3; }
.onsite-qr-heading { display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.onsite-qr-heading .eyebrow { text-transform: uppercase; letter-spacing: .06em; }
.onsite-qr-heading p { margin: 0; }
.onsite-qr-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 24px; align-items: center; padding-top: 20px; }
.onsite-qr-code { display: grid; width: 244px; height: 244px; max-width: 100%; margin: 0 auto; padding: 12px; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.onsite-qr-code img, .onsite-qr-code canvas { display: block; max-width: 100%; height: auto; }
.onsite-stat { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; padding: 12px 14px; background: #fff8f9; border-radius: 11px; }
.onsite-stat span { color: var(--text-secondary); font-size: 11px; }
.onsite-stat strong { font-size: 15px; }
.onsite-link-row { display: flex; gap: var(--space-2); }
.onsite-link-row input { min-width: 0; font-size: 11px; }
.onsite-link-row button { flex: 0 0 44px; }
.onsite-qr-details .field-hint { margin: 8px 0 15px; }
.onsite-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: var(--space-3); margin-top: 20px; }
.onsite-actions .btn { width: 100%; min-height: 44px; }
.onsite-actions #onsite-print { grid-column: 1 / -1; }
.onsite-empty { display: grid; min-height: 260px; place-content: center; justify-items: center; text-align: center; }
.onsite-empty h3 { margin: 8px 0 5px; font-size: 16px; }
.onsite-empty p { max-width: 310px; margin: 0; color: var(--text-secondary); font-size: 12px; }

.team-table .role-label { display: inline-flex; padding: 4px 8px; color: #6e5c63; background: #f4eff1; border-radius: 999px; font-size: 10px; }
.team-actions { display: flex; gap: var(--space-2); }
.team-actions .btn { white-space: nowrap; }
.team-actions .team-delete { color: var(--danger); }
.analytics-status { color: var(--text-secondary); font-size: 12px; }
.analytics-summary { margin-bottom: 17px; overflow: hidden; background: #fff; border: 1px solid var(--border); border-radius: 17px; }
.analytics-summary-item { padding: 18px 20px; }
.analytics-summary-item span { display: block; color: var(--text-secondary); font-size: 11px; }
.analytics-summary-item strong { display: block; margin-top: 4px; font-size: 25px; letter-spacing: -.03em; }
.analytics-summary-item small { color: #9a8f95; font-size: 10px; }
.analytics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.analytics-panel { min-width: 0; padding: 19px; background: #fff; border: 1px solid var(--border); border-radius: 17px; }
.analytics-panel h3 { margin: 0 0 4px; font-size: 14px; font-weight: 700; }
.analytics-panel > p { margin: 0 0 16px; color: var(--text-secondary); font-size: 10px; }
.analytics-distributions { display: contents; }
.analytics-panel-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.analytics-panel-heading h3 { margin: 0; }
.analytics-panel-heading .analytics-overview { min-height: 36px; padding: 6px 12px; }
.timeline-chart { display: grid; grid-auto-flow: column; grid-auto-columns: 56px; align-items: end; gap: 6px; overflow-x: auto; padding: 3px 3px 6px; border-bottom: 1px solid var(--line); }
.timeline-day { display: flex; flex-direction: column; align-items: center; justify-content: end; height: 137px; gap: 5px; padding: 4px 2px; border: 1px solid transparent; border-radius: 10px; background: transparent; }
.timeline-day:hover, .analytics-overview:hover { background: #fff4f6; }
.timeline-day[aria-pressed="true"], .analytics-overview[aria-pressed="true"] { border-color: var(--primary-dark); background: var(--soft); }
.timeline-day:focus-visible, .analytics-overview:focus-visible { outline: 2px solid var(--primary-dark); outline-offset: 1px; }
.timeline-bar { display: block; width: min(22px, 80%); min-height: 2px; background: #ffc6d0; border-radius: 6px 6px 2px 2px; }
.timeline-bar.has-value { background: var(--primary); }
.timeline-day small { color: var(--text-secondary); font-size: 10px; white-space: nowrap; }
.timeline-day b { color: var(--text); font-size: 11px; font-weight: 600; }
.answer-bars { display: grid; gap: 11px; }
.answer-bar-row { display: grid; grid-template-columns: minmax(70px, 1fr) 2fr 32px; align-items: center; gap: 8px; }
.answer-bar-label { overflow: hidden; color: #5f555b; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.answer-bar-track { height: 8px; overflow: hidden; background: #f7eff1; border-radius: 999px; }
.answer-bar-fill { display: block; height: 100%; min-width: 0; background: #f14a65; border-radius: inherit; }
.answer-bar-count { color: #756970; font-size: 10px; text-align: right; }
.number-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.number-stat { flex: 1; min-width: 75px; padding: 11px; background: #fff7f8; border-radius: 11px; }
.number-stat span, .number-stat strong { display: block; }
.number-stat span { color: var(--text-secondary); font-size: 10px; }
.number-stat strong { margin-top: 3px; font-size: 17px; }
.analytics-note { margin-top: 14px; padding: 12px 13px; color: #786d73; background: #fff7f8; border: 1px solid var(--line); border-radius: 12px; font-size: 10px; }
.analytics-note i { margin-right: 5px; color: var(--primary); }
.active-toggle { accent-color: var(--primary); }
.modal-content.app-modal { overflow: visible; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-float); }
.app-modal .modal-header, .app-modal .modal-footer { padding: 17px 20px; border-color: var(--line); }
.app-modal .modal-body { padding: 20px; }
.qr-code { display: grid; width: 218px; height: 218px; margin: 0 auto 16px; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.qr-code img, .qr-code canvas { max-width: 100%; }
.qr-url { max-width: 480px; margin: 0 auto 15px; overflow-wrap: anywhere; color: #756970; font-size: 11px; }
.qr-actions { display: flex; justify-content: center; gap: 8px; }
.app-dropdown-trigger { display: flex; align-items: center; justify-content: space-between; gap: 9px; width: 100%; min-height: 44px; padding: 9px 12px; color: var(--text); background: #fff; border: 1px solid var(--border); border-radius: var(--radius-input); font-size: 13px; text-align: left; }
.app-dropdown-trigger:hover { border-color: #e7a3af; }
.app-dropdown-trigger:disabled { color: #a69ba1; background: #f7f3f4; cursor: not-allowed; }
.dropdown-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-description { display: block; margin-top: 2px; color: var(--text-secondary); font-size: 10px; }
.dropdown-portal { position: fixed; z-index: 2000; min-width: 210px; max-width: min(380px, calc(100vw - 24px)); max-height: min(360px, calc(100vh - 24px)); overflow: auto; padding: 7px; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-float); }
.dropdown-search-wrap { position: sticky; top: -7px; z-index: 2; padding: 6px 3px 8px; background: #fff; }
.dropdown-search { width: 100%; min-height: 37px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; outline: 0; font-size: 12px; }
.dropdown-search:focus { border-color: #e49aa7; box-shadow: 0 0 0 2px rgba(255, 0, 40, .08); }
.dropdown-option { display: block; width: 100%; padding: 9px 10px; color: var(--text); background: #fff; border: 0; border-radius: 9px; text-align: left; cursor: pointer; }
.dropdown-option:hover, .dropdown-option:focus-visible, .dropdown-option.active { background: #fff4f6; outline: 0; }
.dropdown-option.selected { color: var(--primary-dark); background: #fce7eb; font-weight: 600; }
.dropdown-option-label { font-size: 12px; }
.dropdown-empty { padding: 16px 10px; color: var(--text-secondary); font-size: 11px; text-align: center; }
.form-field-row { margin-bottom: 17px; }
.form-field-row > label { display: block; margin: 0 0 6px; color: #4f454b; font-size: 13px; font-weight: 600; }
.required-mark { margin-left: 3px; color: var(--primary); }
.form-field-help { margin: 0 0 var(--space-2); color: #71666c; font-size: 11px; }
.dialog-fields { display: grid; gap: var(--space-4); text-align: start; }
.event-date-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: var(--space-3); }
.choice-list { display: grid; gap: 7px; }
.choice-option { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 9px 11px; background: #fff; border: 1px solid var(--border); border-radius: 11px; font-size: 12px; cursor: pointer; }
.choice-option:has(input:checked) { color: var(--primary-dark); background: #fff3f5; border-color: #f0aeb9; }
.choice-option input { accent-color: var(--primary); }
.upload-control { display: block; width: 100%; padding: 12px; background: #fff; border: 1px dashed #e0bdc4; border-radius: 12px; font-size: 12px; }
.condition-hidden { display: none !important; }
.loading-block, .public-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 56px 20px; color: var(--text-secondary); font-size: 13px; }
.app-toast { font-size: 13px; }

.auth-page { display: grid; min-height: 100vh; padding: 24px; place-items: center; background: radial-gradient(circle at 88% 12%, #ffe8ed 0, transparent 29%), var(--canvas); }
.auth-card { width: min(100%, 440px); padding: 34px; background: #fff; border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 20px 65px rgba(55, 26, 35, .08); }
.auth-card-wide { width: min(100%, 490px); }
.auth-card .brand-mark { margin-bottom: 30px; }
.auth-card .eyebrow { color: var(--primary-dark); }
.auth-card h1 { margin: 0 0 20px; font-size: 26px; font-weight: 700; letter-spacing: -.035em; }
.auth-intro { margin: 0 0 23px; color: var(--text-secondary); font-size: 13px; }
.auth-form { display: grid; gap: 8px; }
.auth-form .form-label { margin-top: 6px; }
.auth-form .app-button { margin-top: 14px; }
.auth-footnote { display: flex; gap: 8px; align-items: flex-start; margin: 19px 0 0; color: var(--text-secondary); font-size: 10px; }
.auth-footnote i { color: var(--primary); font-size: 13px; }

.public-page { min-height: 100vh; padding: clamp(18px, 5vw, 54px) 16px 35px; background: linear-gradient(180deg, #fff1f4 0, var(--canvas) 330px); }
.public-form-shell { width: min(100%, 790px); margin: 0 auto; }
.public-event-header { position: relative; overflow: hidden; margin-bottom: 14px; padding: clamp(22px, 5vw, 38px); background: #fff; border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 10px 30px rgba(55, 26, 35, .035); }
.public-event-header::before { position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--primary); content: ""; }
.public-event-header h1 { max-width: 650px; margin: 0 0 9px; font-size: clamp(23px, 4vw, 34px); font-weight: 700; letter-spacing: -.03em; line-height: 1.3; }
.public-description { margin: 0; color: #70666c; font-size: 13px; white-space: pre-wrap; }
.public-event-meta { display: flex; flex-wrap: wrap; gap: 9px 17px; margin-top: 19px; color: #766c72; font-size: 11px; }
.public-event-meta span { display: inline-flex; align-items: center; gap: 6px; }
.public-event-meta i { color: var(--primary); }
.public-open-badge { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 14px; padding: 5px 10px; color: #19754d; background: #ecf8f1; border-radius: 999px; font-size: 10px; font-weight: 600; }
.public-open-badge.closed { color: #8b3948; background: #fff0f2; }
.public-form-card { padding: clamp(20px, 5vw, 35px); background: #fff; border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 10px 30px rgba(55, 26, 35, .035); }
.public-form-card .form-field-row { margin-bottom: 22px; }
.public-form-card .app-input, .public-form-card .app-textarea { min-height: 46px; font-size: 16px; }
.public-form-card .form-field-row > label { font-size: 14px; }
.privacy-notice { margin-top: 25px; padding: 15px; background: #fff9fa; border: 1px solid var(--line); border-radius: 13px; }
.privacy-notice-title { margin-bottom: 7px; color: #574d53; font-size: 12px; font-weight: 700; }
.privacy-notice-title i { margin-right: 5px; color: var(--primary); }
.privacy-notice p { margin: 0 0 13px; color: #71666c; font-size: 11px; white-space: pre-wrap; }
.privacy-consent { display: flex; align-items: flex-start; gap: 9px; color: #534a50; font-size: 11px; cursor: pointer; }
.privacy-consent input { margin-top: 3px; accent-color: var(--primary); }
.public-form-submit { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 27px; padding-top: 19px; border-top: 1px solid var(--line); }
.public-form-submit small { max-width: 370px; color: var(--text-secondary); font-size: 10px; }
.public-footer { display: flex; justify-content: center; gap: 6px; margin-top: 17px; color: #93878d; font-size: 10px; text-align: center; }
.public-footer i { color: var(--primary); }
.public-closed-card { padding: 35px 20px; background: #fff; border: 1px solid var(--border); border-radius: 20px; text-align: center; }
.public-closed-card .closed-icon { display: grid; width: 55px; height: 55px; margin: 0 auto 13px; place-items: center; color: var(--primary); background: var(--soft); border-radius: 18px; font-size: 22px; }
.public-closed-card h2 { margin: 0 0 6px; font-size: 19px; }
.public-closed-card p { margin: 0; color: var(--text-secondary); font-size: 12px; }
.registration-receipt { width: min(100%, 530px); margin: 0 auto; }
.confirmation-card { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.receipt-header { display: grid; justify-items: center; gap: var(--space-2); padding: 28px var(--space-4) 24px; background: #eaf6ef; color: var(--success); text-align: center; }
.confirmation-mark { display: grid; width: 52px; height: 52px; place-items: center; color: #fff; background: var(--success); border-radius: 50%; font-size: 22px; }
.receipt-header h1, .receipt-not-found h1 { margin: 0; font-size: clamp(22px, 5vw, 29px); font-weight: 700; }
.receipt-header p { margin: 0; font-size: 14px; }
.receipt-body { padding: clamp(16px, 5vw, 28px); }
.receipt-body h2 { margin: 0 0 var(--space-4); font-size: clamp(19px, 4vw, 23px); font-weight: 700; overflow-wrap: anywhere; }
.receipt-details { display: grid; gap: var(--space-3); margin: 0; }
.receipt-details dt { color: var(--text-secondary); font-size: 12px; font-weight: 500; }
.receipt-details dd { margin: 4px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.receipt-reference { padding: var(--space-3); border: 1px dashed var(--border); border-radius: var(--radius-input); background: var(--canvas); }
.receipt-reference dd { font-family: ui-monospace, monospace; font-size: clamp(12px, 3.6vw, 16px); letter-spacing: .04em; }
.receipt-actions { display: grid; justify-items: center; gap: var(--space-2); margin-top: var(--space-4); }
.receipt-actions button { min-height: 44px; }
.receipt-actions button[hidden], #receipt-copy-status:empty { display: none; }
#receipt-copy-status { margin: 0; color: var(--text-secondary); font-size: 12px; }
.receipt-not-found { padding: 28px var(--space-4); text-align: center; }
.receipt-not-found p { margin: var(--space-3) 0 var(--space-4); color: var(--text-secondary); }
.attendee-qr { width: 230px; height: 230px; margin: 18px auto; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 15px; }
.attendee-reference { display: inline-flex; gap: 7px; padding: 8px 12px; color: #675d63; background: #fbf7f8; border-radius: 9px; font-size: 11px; }
.public-error { padding: 24px; color: #873343; background: #fff3f5; border: 1px solid #efc8d0; border-radius: 14px; text-align: center; font-size: 13px; }
.public-form-card .public-error { margin-bottom: var(--space-4); }

@media (max-width: 1100px) {
    .event-row { grid-template-columns: 54px minmax(0, 1fr) 125px 96px; gap: var(--space-3); }
    .event-row .event-actions { grid-column: 2 / -1; justify-content: flex-start; flex-wrap: wrap; }
    .builder-layout, .onsite-layout { grid-template-columns: minmax(0, 1fr); }
    .onsite-qr-details { width: 100%; }
}
@media (max-width: 760px) {
    .sidebar { transform: translateX(-105%); transition: transform .2s ease; box-shadow: none; }
    .sidebar.open { transform: translateX(0); box-shadow: 16px 0 38px rgba(41, 35, 41, .1); }
    .main-area { margin-left: 0; }
    .topbar { min-height: 76px; padding: 12px 17px; }
    .mobile-menu-button { display: inline-grid; width: 38px; height: 38px; margin-right: 8px; place-items: center; }
    .topbar { justify-content: flex-start; }
    .topbar-title { flex: 1; }
    .topbar-title h1 { font-size: 18px; }
    .topbar-title .eyebrow { font-size: 10px; }
    .topbar-user { margin-left: auto; }
    .topbar-user > div:last-child { display: none; }
    .page-content { padding: 23px 15px 42px; }
    .dashboard-metrics { gap: var(--space-2); }
    .section-heading { align-items: flex-start; }
    .section-heading h2 { font-size: 18px; }
    .event-row { grid-template-columns: 50px minmax(0, 1fr); gap: var(--space-2) var(--space-3); padding: 14px; }
    .analytics-grid { grid-template-columns: 1fr; }
    .timeline-chart { gap: 3px; }
    .analytics-summary { border-radius: 14px; }
    .analytics-summary-item { padding: 13px 10px; }
    .analytics-summary-item strong { font-size: 20px; }
    .event-row .event-count { grid-column: 2; grid-row: 2; }
    .event-row .event-state { grid-column: 2; grid-row: 3; }
    .event-row .event-actions { grid-column: 1 / -1; grid-row: 4; margin-top: var(--space-1); }
    .event-date-block { width: 45px; height: 50px; }
    .event-title { font-size: 13px; }
    .event-description { max-width: 230px; font-size: 10px; }
    .event-count { font-size: 11px; }
    .event-count small { display: inline; margin-left: 4px; }
    .list-page-heading { flex-direction: column; }
    .list-page-heading > .app-button, .list-page-heading .export-buttons { align-self: stretch; }
    .export-buttons > * { flex: 1; }
    .builder-toolbar { align-items: flex-start; flex-direction: column; }
    .builder-actions { width: 100%; flex-wrap: wrap; }
    .builder-actions .btn { flex: 1; }
    .builder-layout { gap: 14px; }
    .builder-panel { padding: 16px; border-radius: 16px; }
    .filter-bar { align-items: stretch; flex-direction: column; }
    .event-filter, .search-box { width: 100%; max-width: none; }
    .app-table th, .app-table td { padding: 11px 10px; }
    .auth-page { padding: 14px; }
    .auth-card { padding: 26px 22px; }
    .public-page { padding: 18px 12px 27px; }
    .public-event-header, .public-form-card { border-radius: 17px; }
    .public-form-submit { align-items: stretch; flex-direction: column; }
    .public-form-submit small { max-width: none; }
    .qr-actions { flex-direction: column; }
}
@media (max-width: 540px) {
    .dashboard-header { align-items: start; flex-direction: column; }
    .dashboard-header .dashboard-controls { width: 100%; justify-content: space-between; }
    .dashboard-select { min-width: 122px; }
    .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-metric:last-child { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
    .dashboard-metric:last-child p { margin: 0; }
    .dashboard-bars:not(.dashboard-bars-by-year) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .dashboard-bars li { grid-template-rows: auto 68px auto; }
}
@media (max-width: 420px) {
    .topbar-user { display: none; }
    .event-row { grid-template-columns: 44px minmax(0, 1fr); }
    .event-actions .icon-button { width: 32px; height: 32px; }
    .builder-field { grid-template-columns: 29px minmax(0, 1fr) auto; gap: 7px; }
    .builder-field-title { font-size: 12px; }
    .field-order-actions button { width: 27px; height: 27px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
