:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --text: #111827;
  --muted: #6b7280;
  --line: #d8dee8;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-solid: #ffffff;
  --panel-border: rgba(216, 222, 232, 0.9);
  --surface: #f5f7fb;
  --control-bg: rgba(255, 255, 255, 0.92);
  --control-focus-bg: #ffffff;
  --field-label: #374151;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --danger: #b91c1c;
  --weekend-bg: rgba(220, 38, 38, 0.04);
  --calendar-border: #e5e7eb;
  --button-bg: #ffffff;
  --button-hover-bg: #f3f6fb;
  --button-hover-border: #cbd5e1;
  --list-day-bg: #f3f4f6;
  --list-row-bg: rgba(255, 255, 255, 0.84);
  --map-bg: #334155;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.14);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --text: #f8fafc;
  --muted: #a7b1c2;
  --line: #334155;
  --panel: rgba(15, 23, 42, 0.88);
  --panel-solid: #111827;
  --panel-border: rgba(71, 85, 105, 0.72);
  --surface: #0b1120;
  --control-bg: rgba(30, 41, 59, 0.92);
  --control-focus-bg: #1e293b;
  --field-label: #dbe4ef;
  --primary: #14b8a6;
  --primary-strong: #0d9488;
  --danger: #f87171;
  --weekend-bg: rgba(248, 113, 113, 0.1);
  --calendar-border: #334155;
  --button-bg: #111827;
  --button-hover-bg: #1f2937;
  --button-hover-border: #475569;
  --list-day-bg: #1e293b;
  --list-row-bg: rgba(15, 23, 42, 0.7);
  --map-bg: #475569;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), transparent 38%),
    linear-gradient(315deg, rgba(220, 38, 38, 0.08), transparent 42%), var(--surface);
}

html[data-theme="dark"] body {
  background:
    linear-gradient(135deg, rgba(45, 212, 191, 0.12), transparent 36%),
    linear-gradient(315deg, rgba(248, 113, 113, 0.09), transparent 44%), var(--surface);
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
}

.app-header {
  display: grid;
  gap: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.theme-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.theme-switch-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 54px;
  height: 30px;
  padding: 3px;
  background: var(--button-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: inset 0 1px 4px rgba(15, 23, 42, 0.14);
  transition:
    background 160ms ease,
    border-color 160ms ease;
}

.theme-switch-thumb {
  width: 22px;
  height: 22px;
  background: var(--primary);
  border-radius: 999px;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.22);
  transform: translateX(0);
  transition: transform 160ms ease;
}

.theme-switch input:checked + .theme-switch-track {
  background: rgba(45, 212, 191, 0.18);
  border-color: var(--primary);
}

.theme-switch input:checked + .theme-switch-track .theme-switch-thumb {
  transform: translateX(24px);
}

.theme-switch input:focus-visible + .theme-switch-track {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 3px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.9rem, 4vw, 3.3rem);
  line-height: 1.05;
}

h2 {
  font-size: 1.3rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.select-label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.subscribe-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  color: var(--muted);
  background: var(--control-bg);
  border: 1px solid var(--muted);
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.subscribe-link:hover,
.subscribe-link:focus-visible {
  color: var(--text);
  border-color: var(--text);
}

.division-picker {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
}

.division-picker legend {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.division-picker label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 10px;
  color: #6b7280;
  background: var(--control-bg);
  border: 1px solid #6b7280;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}

.division-choice-1 {
  color: #dc2626;
  border-color: #dc2626;
}

.division-choice-2 {
  color: #2563eb;
  border-color: #2563eb;
}

.division-choice-3 {
  color: #16a34a;
  border-color: #16a34a;
}

.division-choice-4 {
  color: #ea580c;
  border-color: #ea580c;
}

.division-choice-5 {
  color: #7c3aed;
  border-color: #7c3aed;
}

.division-choice-general {
  color: #6b7280;
  border-color: #6b7280;
}

.division-choice-1:has(input:checked) {
  color: #ffffff;
  background: #dc2626;
  border-color: #dc2626;
}

.division-choice-2:has(input:checked) {
  color: #ffffff;
  background: #2563eb;
  border-color: #2563eb;
}

.division-choice-3:has(input:checked) {
  color: #ffffff;
  background: #16a34a;
  border-color: #16a34a;
}

.division-choice-4:has(input:checked) {
  color: #ffffff;
  background: #ea580c;
  border-color: #ea580c;
}

.division-choice-5:has(input:checked) {
  color: #ffffff;
  background: #7c3aed;
  border-color: #7c3aed;
}

.division-choice-general:has(input:checked) {
  color: #ffffff;
  background: #6b7280;
  border-color: #6b7280;
}

.division-picker input {
  width: 15px;
  height: 15px;
}

.division-choice-1 input {
  accent-color: #dc2626;
}

.division-choice-2 input {
  accent-color: #2563eb;
}

.division-choice-3 input {
  accent-color: #16a34a;
}

.division-choice-4 input {
  accent-color: #ea580c;
}

.division-choice-5 input {
  accent-color: #7c3aed;
}

.division-choice-general input {
  accent-color: #6b7280;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.event-panel,
.calendar-wrap {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.event-search {
  padding: 14px 16px 0;
}

.event-search-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--control-bg);
  color: var(--text);
  font-size: 0.95rem;
}

.event-search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--control-focus-bg);
}

.fc-list-event-venue {
  margin-top: 2px;
  font-size: 0.82rem;
  color: var(--muted);
}

.event-panel {
  padding: 18px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(5px);
}

html[data-mode="edit"] .event-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 30;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  transform: translate(-50%, -50%);
}

.detail-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 30;
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  transform: translate(-50%, -50%);
}

.detail-body {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.detail-row {
  display: flex;
  gap: 0.6rem;
  word-break: break-word;
  color: var(--text);
}

.detail-when {
  font-weight: 700;
  font-size: 0.98rem;
}

.detail-label {
  flex: 0 0 4.5rem;
  font-weight: 700;
  color: var(--field-label);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 0.7rem;
  padding-top: 0.12rem;
}

.detail-note span:last-child {
  white-space: pre-wrap;
}

.detail-panel a {
  color: var(--primary);
  text-decoration: underline;
}

.calendar-wrap {
  min-width: 0;
  min-height: 720px;
  padding: 14px;
}

#calendar {
  height: 100%;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.event-panel form {
  display: grid;
  gap: 14px;
}

.event-panel label {
  display: grid;
  gap: 7px;
  color: var(--field-label);
  font-size: 0.92rem;
  font-weight: 700;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.control {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  color: var(--text);
  background: var(--control-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

.control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14);
  background: var(--control-focus-bg);
}

.note-control {
  min-height: 96px;
  resize: vertical;
  line-height: 1.4;
}

.primary-button,
.danger-button,
.icon-button,
.map-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
}

.primary-button {
  padding: 0 16px;
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.22);
}

.primary-button:hover {
  background: var(--primary-strong);
}

.danger-button {
  padding: 0 16px;
  color: #ffffff;
  background: var(--danger);
}

.icon-button {
  width: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--button-bg);
  border-color: var(--line);
}

.icon-button-glyph {
  width: 18px;
  height: 18px;
  display: block;
}

.map-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  color: #ffffff;
  background: var(--map-bg);
  text-decoration: none;
}

.check-row {
  min-height: 42px;
  grid-template-columns: auto 1fr;
  align-items: center;
  align-self: end;
  padding: 0 12px;
  background: var(--button-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.form-message.error {
  color: var(--danger);
}

.form-edited-by {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.actions .map-button {
  grid-column: 1 / -1;
}

.fc {
  --fc-border-color: var(--calendar-border);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: var(--list-day-bg);
  --fc-list-event-hover-bg-color: var(--button-hover-bg);
  --fc-button-bg-color: var(--button-bg);
  --fc-button-border-color: var(--line);
  --fc-button-text-color: var(--text);
  --fc-button-hover-bg-color: var(--button-hover-bg);
  --fc-button-hover-border-color: var(--button-hover-border);
  --fc-button-active-bg-color: var(--primary);
  --fc-button-active-border-color: var(--primary);
  --fc-button-active-text-color: #ffffff;
  --fc-today-bg-color: rgba(15, 118, 110, 0.08);
}

html[data-theme="dark"] .fc {
  --fc-today-bg-color: rgba(45, 212, 191, 0.12);
}

.fc .fc-toolbar-title {
  font-size: clamp(1.2rem, 2.5vw, 1.9rem);
  font-weight: 800;
  letter-spacing: 0;
}

.fc .fc-button {
  border-radius: 8px;
  box-shadow: none;
  font-weight: 700;
}

.fc .fc-event {
  border: 0;
  border-radius: 6px;
  padding: 2px 4px;
  font-weight: 700;
}

.fc .fc-scrollgrid,
.fc .fc-list {
  background: transparent;
}

.fc .fc-list-day-cushion {
  background: var(--list-day-bg);
  color: var(--text);
}

.fc .fc-list-event td {
  background: var(--list-row-bg);
  color: var(--text);
}

.fc .fc-list-event:hover td {
  background: var(--button-hover-bg);
}

.fc .fc-daygrid-day-number,
.fc .fc-col-header-cell-cushion {
  color: var(--text);
  text-decoration: none;
}

.week-header {
  display: grid;
  gap: 2px;
  justify-items: center;
  line-height: 1.1;
  padding: 4px 0;
}

.week-header-day {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.week-header-date {
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
}

.fc .fc-day-sat .fc-daygrid-day-number,
.fc .fc-day-sun .fc-daygrid-day-number,
.fc .fc-day-sat .fc-col-header-cell-cushion,
.fc .fc-day-sun .fc-col-header-cell-cushion,
.fc .fc-day-sat .week-header-day,
.fc .fc-day-sat .week-header-date,
.fc .fc-day-sun .week-header-day,
.fc .fc-day-sun .week-header-date {
  color: #dc2626;
}

.fc .fc-day-sat,
.fc .fc-day-sun {
  background: var(--weekend-bg);
}

.fc .irish-bank-holiday {
  background: #dc2626;
  color: #ffffff;
}

.page-footer {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 0 2px 4px;
}

.admin-login-link {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 0;
  text-decoration: none;
}

.admin-login-link:hover,
.admin-login-link:focus-visible {
  color: var(--primary);
  text-decoration: underline;
}

.footer-terms-link {
  margin-right: auto;
}

/* Standalone legal / terms page */
.legal-page {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 8px 2px 40px;
  color: var(--text);
  line-height: 1.6;
}

.legal-page h2 {
  margin: 28px 0 8px;
  font-size: 1.12rem;
}

.legal-page ul {
  padding-left: 1.25rem;
}

.legal-page li {
  margin-bottom: 6px;
}

.legal-updated {
  color: var(--muted);
  font-size: 0.86rem;
}

.legal-back {
  margin-top: 32px;
}

.legal-back a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.legal-back a:hover,
.legal-back a:focus-visible {
  text-decoration: underline;
}

html[data-mode="visitor"] .event-panel:not(.detail-panel),
html[data-mode="visitor"] #logoutButton,
html[data-mode="edit"] #loginButton {
  display: none;
}

/* The audit trail is admin-only; reveal the button once the session role
   is known to be admin (set on <html> by app.js). */
#auditButton {
  display: none;
}

html[data-role="admin"] #auditButton {
  display: inline;
}

/* Announcement banners */
/* The banner manager is admin-only; reveal the button once the session role
   is known to be admin (set on <html> by app.js). */
#bannerButton {
  display: none;
}

html[data-role="admin"] #bannerButton {
  display: inline;
}

.banner-strip {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.banner-strip:empty {
  display: none;
}

.banner-strip:not(:empty) {
  margin-bottom: 14px;
}

.banner-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 4px solid var(--danger);
  border-radius: 10px;
  background: var(--panel-solid);
  color: var(--text);
}

.banner-item-message {
  margin: 0;
  flex: 1 1 auto;
  text-align: center;
  font-weight: 600;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.banner-item-message a {
  color: var(--danger);
  font-weight: 700;
  text-decoration: underline;
}

.banner-item-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.banner-edit {
  border: 1px solid var(--danger);
  background: transparent;
  color: var(--danger);
  border-radius: 6px;
  padding: 2px 8px;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}

.banner-edit:hover {
  background: var(--danger);
  color: #fff;
}

.banner-remove {
  flex: 0 0 auto;
  border: 1px solid var(--danger);
  background: transparent;
  color: var(--danger);
  border-radius: 6px;
  padding: 2px 8px;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}

.banner-remove:hover {
  background: var(--danger);
  color: #fff;
}

.banner-intro {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.banner-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.banner-list:empty {
  display: none;
}

.banner-list-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--list-row-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.banner-list-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.banner-list-text strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.banner-list-text span {
  color: var(--muted);
  font-size: 0.82rem;
}

.banner-list-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.audit-intro {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

html[data-mode="edit"] .audit-panel {
  width: min(760px, calc(100vw - 32px));
}

html[data-mode="edit"] .admin-health-panel {
  width: min(560px, calc(100vw - 32px));
}

.admin-health-list {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}

.admin-health-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--list-row-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-health-row dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-health-row dd {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.health-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 9px;
  border-radius: 999px;
  color: var(--text);
  background: var(--button-bg);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.health-status-ok,
.health-status-ready {
  color: #065f46;
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.34);
}

.health-status-warning,
.health-status-stale,
.health-status-missing,
.health-status-unknown {
  color: #92400e;
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.36);
}

.health-status-error,
.health-status-not-ready {
  color: #991b1b;
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.34);
}

.health-disk-space {
  display: inline-block;
  margin-left: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.audit-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.audit-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--field-label);
}

.audit-table-wrap {
  overflow-x: auto;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.audit-table th,
.audit-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.audit-table thead th {
  position: sticky;
  top: 0;
  background: var(--panel-solid);
  padding: 0;
}

.audit-sort {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: inherit;
  font-weight: 700;
  padding: 8px 10px;
  width: 100%;
}

.audit-sort:hover,
.audit-sort:focus-visible {
  color: var(--primary);
}

.audit-sort-arrow::after {
  content: "";
}

.audit-sort[data-active="true"][data-direction="asc"] .audit-sort-arrow::after {
  content: "\2191";
}

.audit-sort[data-active="true"][data-direction="desc"] .audit-sort-arrow::after {
  content: "\2193";
}

.audit-action {
  text-transform: capitalize;
  font-weight: 700;
}

.audit-action-created {
  color: var(--primary);
}

.audit-action-deleted {
  color: var(--danger);
}

html[data-mode="visitor"] .workspace,
html[data-mode="edit"] .workspace {
  grid-template-columns: minmax(0, 1fr);
}

html[data-mode="visitor"] .calendar-wrap,
html[data-mode="edit"] .calendar-wrap {
  min-height: calc(100vh - 150px);
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: 100%;
    gap: 12px;
    overflow-x: hidden;
    padding: 12px;
  }

  .app-header {
    gap: 10px;
    min-width: 0;
  }

  h1 {
    font-size: 1.65rem;
    line-height: 1.08;
  }

  .eyebrow {
    font-size: 0.74rem;
  }

  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
    min-width: 0;
  }

  .theme-switch {
    align-self: flex-start;
  }

  .topbar-actions {
    align-self: flex-start;
  }

  .division-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-width: 0;
    overflow: visible;
  }

  .division-picker legend {
    grid-column: 1 / -1;
    margin-bottom: 2px;
    min-width: 0;
  }

  .division-picker label {
    justify-content: flex-start;
    min-height: 34px;
    padding: 0 9px;
    font-size: 0.8rem;
    min-width: 0;
    width: 100%;
  }

  .division-picker label span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .calendar-wrap {
    width: calc(100vw - 24px);
    min-height: calc(100vh - 180px);
    max-width: 100%;
    overflow-x: hidden;
    padding: 6px;
  }

  .event-panel,
  .calendar-wrap,
  .modal-backdrop {
    backdrop-filter: none;
  }

  #calendar,
  .fc,
  .fc-view-harness,
  .fc-view,
  .fc-dayGridMonth-view {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  html[data-mode="edit"] .event-panel {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(88vh, 720px);
    padding: 16px 14px max(16px, env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
    overscroll-behavior: contain;
    transform: none;
  }

  .panel-heading {
    margin-bottom: 14px;
  }

  .control,
  .primary-button,
  .danger-button,
  .map-button,
  .check-row {
    min-height: 46px;
  }

  .fc .fc-toolbar.fc-header-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
  }

  .fc .fc-toolbar-chunk {
    display: flex;
    justify-content: center;
    min-width: 0;
  }

  .fc .fc-toolbar-chunk:nth-child(2) {
    order: -1;
  }

  .fc .fc-toolbar-title {
    font-size: 1.08rem;
    line-height: 1.2;
    text-align: center;
  }

  .fc .fc-button {
    min-height: 36px;
    padding: 0.28rem 0.48rem;
    font-size: 0.78rem;
  }

  .fc .fc-button-group {
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    width: min(100%, 352px);
  }

  .fc .fc-col-header-cell-cushion,
  .fc .fc-daygrid-day-number {
    padding: 4px 3px;
    font-size: 0.76rem;
  }

  .fc .fc-daygrid-day-frame {
    min-height: 74px;
  }

  .fc .fc-event {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    padding: 1px 3px;
    font-size: 0.72rem;
    line-height: 1.2;
  }

  .fc-dayGridMonth-view .fc-daygrid-event,
  .fc-dayGridMonth-view .fc-event-main,
  .fc-dayGridMonth-view .fc-event-title,
  .fc-dayGridMonth-view .fc-event-time {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .fc-dayGridMonth-view .fc-daygrid-event-dot {
    flex: 0 0 auto;
    margin-right: 3px;
  }

  .fc .fc-timegrid-slot-label,
  .fc .fc-timegrid-axis-cushion {
    font-size: 0.74rem;
  }

  .fc-list {
    overflow: hidden;
  }

  .fc-list .fc-list-table {
    display: block;
    table-layout: fixed;
    width: 100%;
  }

  .fc-list .fc-list-table tbody {
    display: block;
    width: 100%;
  }

  .fc-list .fc-list-day,
  .fc-list .fc-list-event {
    display: grid;
    width: 100%;
  }

  .fc-list .fc-list-day th {
    display: block;
    grid-column: 1 / -1;
  }

  .fc-list .fc-list-event {
    grid-template-columns: 118px 18px minmax(0, 1fr);
    align-items: center;
  }

  .fc-list .fc-list-day-cushion {
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .fc-list .fc-list-event td {
    display: block;
    padding: 10px 8px;
  }

  .fc-list .fc-list-event-time {
    width: auto;
    color: var(--muted);
    font-size: 0.74rem;
    white-space: nowrap;
  }

  .fc-list .fc-list-event-graphic {
    width: auto;
    text-align: center;
  }

  .fc-list .fc-list-event-title {
    min-width: 0;
    font-size: 0.88rem;
    font-weight: 700;
    overflow-wrap: anywhere;
  }

  .fc-list .fc-list-event-title a {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .fc-timeGridWeek-view .fc-scrollgrid {
    min-width: 680px;
  }

  .fc-timeGridWeek-view,
  .fc-timeGridDay-view {
    overflow-x: auto;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .page-footer {
    justify-content: center;
  }
}

/* Saved locations */
.control-locked {
  background: var(--button-bg);
  color: var(--muted);
  cursor: not-allowed;
}

html[data-mode="edit"] .venue-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 30;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  transform: translate(-50%, -50%);
  padding: 18px;
}

.venue-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.venue-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--list-row-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.venue-row-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.venue-row-text strong {
  color: var(--text);
}

.venue-row-text span,
.venue-row-text a {
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.venue-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.venue-row-actions button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.82rem;
}

.venue-empty {
  padding: 10px 12px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

@media (max-width: 760px) {
  html[data-mode="edit"] .venue-panel {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(88vh, 720px);
    border-radius: 8px 8px 0 0;
    transform: none;
  }

  .venue-row {
    flex-direction: column;
    align-items: stretch;
  }
}

.label-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.inline-link-button {
  background: none;
  border: none;
  color: var(--accent, #0f766e);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  padding: 0;
  text-decoration: underline;
}

.inline-link-button:hover {
  opacity: 0.8;
}

.event-tooltip {
  position: absolute;
  z-index: 1000;
  max-width: 320px;
  padding: 0.65rem 0.8rem;
  background: var(--surface, #ffffff);
  color: var(--text, #111827);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  font-size: 0.85rem;
  line-height: 1.35;
  pointer-events: auto;
}

html[data-theme="dark"] .event-tooltip {
  background: #1f2937;
  color: #f3f4f6;
  border-color: rgba(255, 255, 255, 0.1);
}

.event-tooltip .tip-row {
  display: flex;
  gap: 0.4rem;
  padding: 0.15rem 0;
  word-break: break-word;
}

.event-tooltip .tip-row + .tip-row {
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  padding-top: 0.3rem;
  margin-top: 0.25rem;
}

html[data-theme="dark"] .event-tooltip .tip-row + .tip-row {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.event-tooltip .tip-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.event-tooltip .tip-label {
  flex: 0 0 4.5rem;
  font-weight: 600;
  color: var(--muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 0.7rem;
  padding-top: 0.1rem;
}

.event-tooltip .tip-note span:last-child {
  white-space: pre-wrap;
}

.event-tooltip a {
  color: var(--accent, #0f766e);
  text-decoration: underline;
}

.event-tooltip a:hover {
  opacity: 0.85;
}

.event-tooltip .tip-when {
  color: var(--muted, #6b7280);
  font-size: 0.8rem;
}

/* Confirm / alert dialog */
.confirm-dialog-backdrop {
  z-index: 60;
}

.confirm-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 61;
  max-width: min(420px, calc(100vw - 32px));
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.confirm-dialog-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.confirm-dialog-message {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
  white-space: pre-line;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.confirm-dialog-button {
  min-width: 96px;
}
