:root {
    color-scheme: light;
    --page: #f8f8f2;
    --surface: #fff;
    --surface-raised: #f2f5eb;
    --surface-hover: #e7eee4;
    --border: #dfe5dc;
    --border-strong: #b7c8bb;
    --text: #172b28;
    --muted: #53665e;
    --accent: #214f41;
    --accent-soft: #e3eee4;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--page); color: var(--text); font: 16px/1.5 system-ui, sans-serif; }
a { color: inherit; }
a:focus-visible, input:focus-visible, button:focus-visible { outline: 3px solid #a85839; outline-offset: 2px; }
h1 { margin: 0 0 8px; font: 400 2.2rem/1.1 Georgia, "Times New Roman", serif; letter-spacing: -.04em; }
p { color: var(--muted); margin: 0 0 24px; }
button { font: inherit; cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }

.auth-page { display: grid; place-items: center; padding: 24px; background: #f2f5eb; }
.auth-card { width: 100%; max-width: 420px; padding: 32px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 20px 60px #345d491c; }
.auth-card label { display: block; font-weight: 600; margin: 18px 0 6px; }
.auth-card input:not([type=checkbox]) { width: 100%; padding: 11px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.auth-card .remember { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.auth-card .error { color: #a42f26; margin: 6px 0 0; font-size: .9rem; }
.auth-card button { width: 100%; margin-top: 20px; padding: 12px; border: 1px solid var(--accent); border-radius: 8px; color: #fff; background: var(--accent); font-weight: 700; }
.auth-card button:hover { background: #173c30; }

.skip-link { position: absolute; top: -100px; left: 16px; z-index: 2; padding: 8px 12px; background: var(--surface); color: var(--text); }
.skip-link:focus { top: 12px; }
.app-header { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
.app-brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); font-size: 1.35rem; font-weight: 750; letter-spacing: -.05em; text-decoration: none; }
.app-brand::before { content: ""; flex: none; width: 19px; height: 19px; background: linear-gradient(#d77c5e, #d77c5e) 0 0 / 8px 8px, linear-gradient(#e2ae74, #e2ae74) 11px 0 / 8px 8px, linear-gradient(#91aa96, #91aa96) 0 11px / 8px 8px, linear-gradient(#426d5a, #426d5a) 11px 11px / 8px 8px; background-repeat: no-repeat; transform: rotate(-10deg); }
.header-actions { display: flex; align-items: center; gap: 16px; min-width: 0; }
.settings-link, .profile-toggle { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 9px; color: var(--muted); transition: background-color .18s ease, color .18s ease; }
.settings-link:hover, .settings-link[aria-current=page], .profile-toggle:hover, .profile-menu[open] .profile-toggle { background: var(--surface-hover); color: var(--text); }
.profile-menu { position: relative; }
.profile-toggle { list-style: none; cursor: pointer; }
.profile-toggle::-webkit-details-marker { display: none; }
.profile-toggle:focus-visible { outline: 3px solid #a85839; outline-offset: 2px; }
.profile-dropdown { position: absolute; top: calc(100% + 8px); right: 0; z-index: 3; width: min(280px, calc(100vw - 32px)); padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 16px 40px #345d4926; }
.profile-email { margin: 0 0 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: .875rem; overflow-wrap: anywhere; }
.profile-dropdown a, .profile-dropdown button { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; text-align: left; text-decoration: none; }
.profile-dropdown a:hover, .profile-dropdown button:hover { background: var(--surface-hover); }
.profile-dropdown form { margin: 0; }
.user-name { overflow: hidden; color: var(--muted); font-size: .875rem; text-overflow: ellipsis; white-space: nowrap; }
.logout-button { padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: transparent; color: var(--text); white-space: nowrap; }
.logout-button:hover { background: var(--surface-hover); }
.app-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.sidebar { padding: 28px 16px; border-right: 1px solid var(--border); background: var(--surface); }
.nav-group + .nav-group { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--muted); font-size: .9rem; font-weight: 500; text-decoration: none; transition: background-color .18s ease, color .18s ease; }
.nav-link:hover { background: var(--surface-hover); color: var(--text); }
.nav-link.active { background: var(--accent-soft); box-shadow: inset 2px 0 var(--accent); color: var(--text); }
.nav-link svg { width: 18px; height: 18px; flex: none; }
.workspace-nav { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.workspace-name { font-weight: 700; overflow-wrap: anywhere; }
.workspace-link { padding-left: 28px; }
.organization-menu { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.organization-switcher { display: grid; gap: 8px; margin: 0; }
.organization-menu-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.organization-menu-heading a { color: var(--muted); font-size: .75rem; }
.organization-switcher label { color: var(--text); font-size: .875rem; font-weight: 600; }
.organization-switcher select { width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: .875rem; }
.organization-switcher select:focus-visible { outline: 3px solid #a85839; outline-offset: 2px; }
.organization-switcher button { justify-self: start; }
.app-content { padding: 40px; }
.workspace-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 32px; }
.count-card { display: grid; grid-template-rows: 1fr auto; gap: 6px; padding: 20px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: 0 8px 24px #345d490d; transition: transform .18s ease, border-color .18s ease; }
.count-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.count-card span { color: var(--muted); font-size: .9rem; }
.count-card strong { font-size: 1.8rem; }
.count-card-link { position: relative; padding-right: 48px; color: inherit; text-decoration: none; cursor: pointer; }
.count-card-link::after { content: "\2192"; position: absolute; right: 20px; bottom: 20px; color: var(--accent); }
.upcoming-events h2 { font-size: 1.15rem; }
.upcoming-event { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.upcoming-event > .event-status { align-self: center; flex-shrink: 0; }
.upcoming-event time { color: var(--muted); }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.page-heading p { margin-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions form { margin: 0; }
.audience-create { margin-bottom: 24px; }
.audience-management { align-items: flex-end; }
.audience-management .field { flex: 1 1 150px; margin-bottom: 0; }
.button { display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: #fff; font: inherit; font-size: .875rem; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .18s ease, background-color .18s ease; }
.button.secondary { border-color: var(--border-strong); background: var(--surface); color: var(--text); }
.button.danger { border-color: #d8a9a2; background: var(--surface); color: #942d25; }
.button:hover { background: #173c30; transform: translateY(-1px); }
.button.secondary:hover { background: var(--surface-hover); }
.button.danger:hover { background: #fbece9; }
.table-wrap, .dashboard-panel { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: 0 8px 24px #345d490d; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: var(--surface-raised); color: var(--muted); font-size: .8rem; }
tbody tr { transition: background-color .15s ease; }
tbody tr:hover { background: #f5f8f3; }
tbody tr:last-child td { border-bottom: 0; }
.secondary-text { display: block; color: var(--muted); font-size: .85rem; }
.content-table { min-width: 860px; }
.content-title { min-width: 180px; overflow-wrap: anywhere; }
.listing-image { display: block; width: 80px; max-height: 60px; object-fit: cover; border-radius: 6px; margin-bottom: 8px; }
.content-type-options { display: grid; gap: 16px; margin-top: 16px; }
.content-type-options .category-option { flex-wrap: wrap; }
.workflow-steps { padding-left: 24px; margin-bottom: 24px; }
.workflow-steps li { margin-bottom: 12px; }
.tag-navigation { margin: 16px 0 24px; }
.tag-overview h2 { margin: 0 0 6px; font-size: 1.15rem; }
.tag-overview p { margin-bottom: 12px; }
.tag-help { margin-bottom: 16px; color: var(--muted); font-size: .875rem; }
.tag-help summary { width: fit-content; color: var(--text); cursor: pointer; }
.tag-help p { margin: 10px 0 0; }
.tag-permissions { margin-bottom: 16px; font-size: .875rem; }
.tag-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.tag-status-filter { align-items: flex-end; }
.tag-status-filter .field { margin: 0; min-width: 150px; }
.tag-add { position: relative; margin-left: auto; }
.tag-add summary { list-style: none; }
.tag-add summary::-webkit-details-marker { display: none; }
.tag-create { position: absolute; z-index: 4; top: calc(100% + 8px); right: 0; width: min(420px, calc(100vw - 40px)); }
.tag-create .field { margin-bottom: 16px; }
.tag-table { min-width: 540px; }
.tag-table .tag-name { max-width: 280px; background: transparent; color: inherit; font-size: 1rem; overflow-wrap: anywhere; }
.tag-usage { font-variant-numeric: tabular-nums; }
.tag-editor-row td { background: var(--surface-raised); }
.tag-editor { max-width: 540px; }
.tag-editor h3 { margin-top: 0; }
.table-wrap:focus-visible, .tag-editor:focus-visible { outline: 3px solid #a85839; outline-offset: 2px; }
.dashboard-section { margin: 32px 0; }
.dashboard-section h2 { font-size: 1.15rem; }
.dashboard-panel .page-heading { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0; padding: 14px 20px; border-bottom: 1px solid var(--border); border-radius: 9px 9px 0 0; background: var(--surface-raised); }
.dashboard-panel h2 { margin: 0; }
.dashboard-panel .upcoming-event { padding: 14px 20px; }
.dashboard-panel .upcoming-event > a, .dashboard-panel .upcoming-event > div { min-width: 0; overflow-wrap: anywhere; }
.dashboard-panel .upcoming-event:last-child { border-bottom: 0; }
.dashboard-panel > p { margin: 0; padding: 20px; }
.organization-profile { display: grid; grid-template-columns: minmax(0, 100px) minmax(0, 1fr); gap: 12px 16px; margin: 20px 0; }
.organization-profile dt { color: var(--muted); }
.organization-profile dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.pagination { display: flex; align-items: center; gap: 12px; margin-top: 20px; }
.editor-form { max-width: 720px; padding: 24px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: 0 8px 24px #345d490d; }
.image-preview { display: block; max-width: min(100%, 300px); max-height: 200px; object-fit: contain; }
.field { display: grid; gap: 6px; margin-bottom: 20px; }
.field label { font-weight: 600; }
.field-heading { display: flex; align-items: baseline; gap: 12px; }
.clear-field { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: .875rem; text-decoration: underline; cursor: pointer; }
.field input:not([type=checkbox]):not([type=radio]), .field textarea, .field select { width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.field textarea { resize: vertical; }
.rich-text-editor { overflow: hidden; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.rich-text-toolbar, .rich-text-link { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px; border-bottom: 1px solid var(--border); background: var(--surface-raised); }
.rich-text-link[hidden] { display: none; }
.rich-text-toolbar button, .rich-text-link button { padding: 5px 9px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); color: var(--text); font-size: .875rem; }
.rich-text-toolbar button[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); }
.rich-text-editor .tiptap { min-height: 180px; padding: 12px; overflow-wrap: anywhere; }
.rich-text-editor .tiptap:focus-visible { outline: 3px solid #a85839; outline-offset: -3px; }
.rich-text-editor .tiptap p, .rich-text p { margin: 0 0 1em; color: inherit; }
.rich-text-editor .tiptap h2, .rich-text h2 { margin: 1em 0 .5em; font-size: 1.3rem; }
.rich-text-editor .tiptap > :first-child, .rich-text > :first-child { margin-top: 0; }
.rich-text-editor .tiptap a, .rich-text a { color: #27604b; text-decoration: underline; }
.rich-text { white-space: pre-line; overflow-wrap: anywhere; margin-bottom: 24px; }
.field select:focus-visible, .field textarea:focus-visible { outline: 3px solid #a85839; outline-offset: 2px; }
.field-checkbox { display: flex; align-items: center; gap: 8px; }
.business-fieldset, .category-fieldset, .location-type-fieldset { min-width: 0; padding: 0; border: 0; }
.business-fieldset legend, .category-fieldset legend, .location-type-fieldset legend { padding: 0; font-weight: 600; }
.business-list { display: grid; gap: 8px; max-height: 240px; overflow-y: auto; }
.category-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 8px 16px; }
.field .business-option, .field .category-option, .field .location-type-option { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.category-option { min-width: 0; overflow-wrap: anywhere; }
.category-option input { flex-shrink: 0; }
.field small { color: var(--muted); }
.field-error { color: #a42f26; font-size: .875rem; }
.notice, .form-errors { margin-bottom: 20px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-raised); }
.form-errors { border-color: #d8a9a2; background: #fbece9; color: #942d25; }
.form-actions { margin-top: 24px; }
.recurrence { margin: 0 0 20px; padding: 18px; border: 1px solid var(--border-strong); border-radius: 6px; }
.recurrence legend { padding: 0 6px; font-weight: 600; }
.recurrence small { color: var(--muted); }
[hidden] { display: none !important; }
.event-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 20px; }
.event-filter label { font-weight: 600; }
.event-filter select, .event-filter input[type=search] { max-width: 100%; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: .875rem; }
.event-filter input[type=search] { width: 260px; min-width: 0; }
.event-filter select:focus-visible { outline: 3px solid #a85839; outline-offset: 2px; }
.event-view-switcher { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.event-view-icon { width: 40px; height: 40px; padding: 0; }
.event-toolbar { margin-bottom: 16px; }
.event-toolbar-primary { position: relative; display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.content-toolbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 14px; align-items: end; margin-bottom: 24px; }
.content-toolbar .event-search { grid-column: span 2; max-width: none; }
.event-filter-field { display: grid; min-width: 0; gap: 5px; }
.event-filter-field label { color: var(--text); font-size: .875rem; font-weight: 600; }
.event-filter-field input, .event-filter-field select { width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: .875rem; }
.event-filter-field select:focus-visible { outline: 3px solid #a85839; outline-offset: 2px; }
.event-search { flex: 1 1 240px; max-width: 440px; }
.event-more, .event-filter-drawer { position: relative; }
.event-more summary, .event-filter-drawer summary, .event-row-menu summary { list-style: none; }
.event-more summary::-webkit-details-marker, .event-filter-drawer summary::-webkit-details-marker, .event-row-menu summary::-webkit-details-marker { display: none; }
.event-more summary::after, .event-filter-drawer summary::after { content: "\25be"; margin-left: 6px; }
.event-more-menu, .event-filter-panel { position: absolute; z-index: 4; top: calc(100% + 8px); right: 0; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: 0 16px 40px #345d4926; }
.event-more-menu { min-width: 180px; }
.event-more-menu a, .event-menu-items a, .event-menu-items button { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-size: .875rem; text-align: left; text-decoration: none; cursor: pointer; }
.event-more-menu a:hover, .event-menu-items a:hover, .event-menu-items button:hover { background: var(--surface-hover); }
.event-filter-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: min(600px, calc(100vw - 40px)); max-height: min(70vh, 600px); overflow-y: auto; }
.active-event-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; font-size: .875rem; }
.event-filter-chip { display: inline-flex; gap: 8px; align-items: center; padding: 5px 10px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; }
.event-filter-chip:hover { background: var(--surface-hover); }
.event-row-menu { min-width: 42px; }
.event-menu-items { min-width: 120px; margin-top: 6px; padding: 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.event-menu-items.is-floating { position: fixed; z-index: 10; width: max-content; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow-y: auto; margin: 0; box-shadow: 0 16px 40px #345d4926; }
.event-menu-items form { margin: 0; }
.event-menu-items .event-menu-danger { color: #942d25; }
.event-status { display: inline-block; padding: 3px 8px; border-radius: 5px; font-size: .8rem; font-weight: 600; }
.status-published { background: #e4f2e6; color: #245c35; }
.status-draft { background: #e9ede8; color: #3e5148; }
.status-pending { background: #e8eef8; color: #274c7a; }
.status-cancelled { background: #fae9e7; color: #942d25; }
.status-archived { background: #f0ece8; color: #625247; }
.event-empty { padding: 24px; text-align: center; }
.event-empty div { margin: 8px 0 16px; }
.calendar-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.calendar-header h2 { margin: 0; font-size: 1.2rem; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.calendar-weekday, .calendar-day { min-width: 0; padding: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.calendar-weekday { background: var(--surface-raised); color: var(--muted); font-size: .8rem; font-weight: 600; }
.calendar-day { min-height: 120px; background: var(--surface); }
.calendar-day.outside-month { background: #f1f3ed; color: var(--muted); }
.calendar-event { display: block; margin-top: 6px; padding: 5px; border-radius: 4px; font-size: .8rem; text-decoration: none; overflow-wrap: anywhere; }
.calendar-event:hover { text-decoration: underline; }
.calendar-date-long { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

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

@media (max-width: 640px) {
    .app-header { padding: 12px 16px; }
    .header-actions { gap: 10px; }
    .user-name { max-width: 120px; }
    .app-layout { display: block; }
    .sidebar { padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--border); }
    .nav-group { display: flex; flex-wrap: wrap; gap: 4px; }
    .nav-group + .nav-group { margin-top: 8px; padding-top: 8px; }
    .workspace-nav { margin-top: 8px; padding-top: 8px; }
    .organization-switcher { max-width: 320px; }
    .workspace-link { padding-left: 12px; }
    .nav-link { width: fit-content; }
    .app-content { padding: 28px 20px; }
    .page-heading { flex-direction: column; }
    .editor-form { padding: 18px; }
    .event-search { flex-basis: 100%; max-width: none; }
    .content-toolbar .event-search { grid-column: auto; }
    .event-filter-drawer { position: static; }
    .event-filter-panel { grid-template-columns: 1fr; right: auto; left: 0; width: min(320px, 100%); }
    .event-table, .event-table tbody, .event-table tr, .event-table td { display: block; width: 100%; }
    .event-table thead { display: none; }
    .event-table tr { padding: 12px; border-bottom: 1px solid var(--border); }
    .event-table tr:last-child { border-bottom: 0; }
    .event-table td { padding: 5px 0; border: 0; }
    .event-table td:not(:first-child)::before { content: attr(data-label) ': '; color: var(--muted); font-size: .8rem; font-weight: 600; }
    .calendar-grid { grid-template-columns: minmax(0, 1fr); }
    .calendar-weekday, .calendar-day.outside-month { display: none; }
    .calendar-day { min-height: 0; }
    .calendar-date-short { display: none; }
    .calendar-date-long { display: inline; }
}
