:root {
  --ink: #17202a;
  --muted: #667085;
  --line: #d9dee7;
  --panel: #ffffff;
  --surface: #f6f8fb;
  --accent: #2f6fed;
  --accent-2: #d8562a;
  --good: #0f7b5f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface);
}

html:has(body.data-page),
html:has(body.settings-page),
html:has(body.system-page),
body.data-page,
body.settings-page,
body.system-page {
  height: auto;
  overflow: auto;
}

.system-page {
  min-height: 100%;
  background: #f4f7fb;
}

.settings-header-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.settings-header-links .settings-back-link {
  margin-bottom: 30px;
}

.system-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 36px 28px 64px;
}

.system-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.system-header h1,
.system-section-heading h2,
.system-card h3 {
  margin: 0;
}

.system-header h1 {
  font-size: clamp(30px, 5vw, 48px);
  letter-spacing: -0.04em;
}

.system-intro {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.system-health {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 3px;
  min-width: 190px;
  padding: 13px 16px;
  border: 1px solid #b7dfd2;
  border-radius: 14px;
  color: #16644f;
  background: #edfbf6;
}

.system-health strong { font-size: 14px; }
.system-health span { font-size: 12px; }
.system-health.is-error { color: #912018; border-color: #f0b7b2; background: #fff0ef; }

.system-tabs {
  display: flex;
  gap: 4px;
  width: max-content;
  margin-bottom: 20px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.system-tab {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 9px;
  color: #475467;
  background: transparent;
  font-weight: 750;
  cursor: pointer;
}

.system-tab.is-active { color: #fff; background: var(--accent); }

.system-view {
  display: grid;
  gap: 20px;
}

.system-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.system-readonly-badge {
  padding: 6px 10px;
  border-radius: 999px;
  color: #475467;
  background: #e9eef6;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.stack-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.stack-card,
.system-card,
.architecture-panel,
.database-browser {
  border: 1px solid #dce2eb;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(23, 32, 42, 0.045);
}

.stack-card {
  min-height: 116px;
  padding: 18px;
}

.stack-card span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stack-card strong { font-size: 14px; line-height: 1.45; }
.architecture-panel { padding: 24px; overflow: hidden; }

.pipeline-flow {
  display: grid;
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  gap: 24px;
  overflow-x: auto;
  padding: 6px 2px 16px;
}

.pipeline-step {
  position: relative;
  min-height: 156px;
  padding: 16px;
  border: 1px solid #dce2eb;
  border-radius: 15px;
  background: linear-gradient(180deg, #fff, #f8faff);
}

.pipeline-step:not(:last-child)::after {
  position: absolute;
  top: 50%;
  right: -19px;
  width: 12px;
  height: 12px;
  border-top: 2px solid #98a7bc;
  border-right: 2px solid #98a7bc;
  content: "";
  transform: translateY(-50%) rotate(45deg);
}

.pipeline-number {
  display: grid;
  width: 30px;
  height: 30px;
  margin-bottom: 18px;
  border-radius: 9px;
  place-items: center;
  color: #fff;
  background: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

.pipeline-step strong { font-size: 14px; }
.pipeline-step p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

.system-two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.system-card { padding: 22px; }
.system-card h3 { margin-bottom: 16px; }

.system-definition-list { margin: 0; }
.system-definition-list div {
  display: grid;
  grid-template-columns: minmax(130px, 0.75fr) 1.25fr;
  gap: 14px;
  padding: 11px 0;
  border-top: 1px solid #edf0f5;
}
.system-definition-list dt { color: var(--muted); }
.system-definition-list dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

.database-table-cards {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 9px;
}

.database-table-card {
  display: flex;
  min-height: 108px;
  padding: 14px;
  border: 1px solid #dce2eb;
  border-radius: 14px;
  flex-direction: column;
  align-items: flex-start;
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.database-table-card:hover,
.database-table-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(47, 111, 237, 0.1); }
.database-table-card span { min-height: 32px; color: #475467; font-size: 12px; font-weight: 750; }
.database-table-card strong { margin-top: auto; font-size: 24px; }
.database-table-card small { color: var(--muted); }

.database-browser { min-width: 0; padding: 20px; }
.database-toolbar {
  display: grid;
  grid-template-columns: minmax(190px, 0.45fr) minmax(260px, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.database-toolbar label { display: grid; gap: 6px; color: #475467; font-size: 12px; font-weight: 750; }
.database-toolbar select,
.database-toolbar input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
}
.database-toolbar .text-button { min-height: 44px; }
.database-grid-wrap { max-height: 64vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.database-grid { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.database-grid th,
.database-grid td { max-width: 340px; padding: 10px 12px; border-right: 1px solid #edf0f5; border-bottom: 1px solid #edf0f5; vertical-align: top; text-align: left; }
.database-grid th { position: sticky; top: 0; z-index: 1; color: #475467; background: #f8faff; white-space: nowrap; }
.database-grid td > span,
.database-grid td > code { display: block; max-height: 92px; overflow: hidden; overflow-wrap: anywhere; white-space: pre-wrap; }
.database-null { color: #98a2b3; font-style: italic; }
.database-empty { padding: 32px !important; color: var(--muted); text-align: center !important; }
.row-inspect-button { padding: 7px 10px; border: 1px solid #b8c7e4; border-radius: 8px; color: #2459bd; background: #f4f7ff; font-size: 11px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.database-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding-top: 14px; color: var(--muted); font-size: 12px; }

.database-row-dialog { width: min(900px, calc(100% - 28px)); max-height: 86vh; padding: 0; border: 0; border-radius: 18px; box-shadow: 0 28px 90px rgba(11, 18, 30, 0.3); }
.database-row-dialog::backdrop { background: rgba(19, 27, 41, 0.48); backdrop-filter: blur(3px); }
.database-row-sheet { padding: 22px; }
.database-row-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.database-row-heading h2 { margin: 0; }
.database-row-sheet pre { max-height: 66vh; margin: 18px 0 0; padding: 16px; overflow: auto; border-radius: 12px; color: #dce6f8; background: #17202a; font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 1000px) {
  .stack-cards { grid-template-columns: repeat(2, 1fr); }
  .database-table-cards { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 640px) {
  .system-shell { padding: 22px 12px 40px; }
  .system-header { align-items: stretch; flex-direction: column; }
  .system-health { min-width: 0; }
  .system-tabs { width: 100%; }
  .system-tab { flex: 1; padding: 0 10px; }
  .system-section-heading { align-items: flex-start; }
  .stack-cards { grid-template-columns: 1fr; }
  .stack-card { min-height: 90px; }
  .system-two-column { grid-template-columns: 1fr; }
  .system-definition-list div { grid-template-columns: 1fr; gap: 4px; }
  .database-table-cards { display: flex; margin-right: -12px; padding-right: 12px; overflow-x: auto; }
  .database-table-card { flex: 0 0 145px; }
  .database-browser { padding: 14px; }
  .database-toolbar { grid-template-columns: 1fr; }
  .database-toolbar .text-button { width: 100%; }
  .database-grid-wrap { max-height: 58vh; }
  .database-pagination { justify-content: space-between; }
  .database-row-sheet { padding: 17px; }
}

button,
input {
  font: inherit;
}

input[type="date"] {
  color-scheme: light;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(360px, 420px) 1fr;
  height: 100dvh;
  min-height: 0;
}

.panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 10;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 16px;
}

.view-nav {
  display: grid;
  gap: 4px;
  padding: 0 16px 16px;
}

.nav-group-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 12px 8px 2px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 0 10px;
  text-align: left;
  text-decoration: none;
}

.nav-item:hover,
.nav-item[aria-pressed="true"] {
  border-color: #bfd1f7;
  background: #eef4ff;
  color: var(--accent);
  font-weight: 700;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 4px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  font-size: 17px;
}

.icon-button,
.text-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 22px;
}

.icon-button.is-loading span {
  animation: spin 800ms linear infinite;
}

.text-button {
  min-height: 36px;
  border-radius: 8px;
  padding: 0 12px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 24px 16px;
}

.status-strip div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  min-width: 0;
}

.status-strip strong,
.status-strip span {
  display: block;
}

.status-strip strong {
  font-size: 18px;
}

.status-strip span {
  color: var(--muted);
  font-size: 12px;
}

.controls {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 24px;
}

.search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.search input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 0 12px;
}

.date-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.date-range label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.date-range input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 0 10px;
}

.range-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.mini-button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  padding: 0 10px;
  font-size: 13px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.checkbox-line input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.control-group + .control-group {
  margin-top: 16px;
}

.group-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.control-hint {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.home-actions,
.agenda-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.agenda-actions {
  display: none;
}

.mini-button.is-active,
.view-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: #eef4ff;
  color: var(--accent);
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 34px;
  padding: 0 12px;
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.chip[aria-pressed="false"] {
  color: var(--muted);
  background: #f8fafc;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px 10px;
}

.list-header h2 {
  margin-right: auto;
}

.event-sort-control {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  gap: 7px;
}

.event-sort-control select {
  appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m3 5 3 3 3-3' fill='none' stroke='%23657386' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 9px center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  min-height: 36px;
  padding: 0 30px 0 10px;
}

.view-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  padding: 0 10px;
  font-size: 13px;
}

.event-list {
  display: grid;
  gap: 10px;
  padding: 0 16px 24px;
}

.event-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  cursor: pointer;
}

.event-card:hover,
.event-card.is-active {
  border-color: var(--accent);
}

.event-date {
  color: var(--good);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 5px;
}

.event-timing-row {
  margin: 0 0 7px;
}

.event-timing {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  padding: 3px 7px;
  vertical-align: middle;
  width: max-content;
}

.event-timing-upcoming {
  background: #eaf2ff;
  color: #2459a9;
}

.event-timing-happening {
  background: #e4f7ef;
  color: #0a6a4f;
}

.event-timing-past {
  background: #edf0f4;
  color: #667085;
}

.event-timing-unknown {
  background: #f4f1e8;
  color: #705d27;
}

.event-title {
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 8px;
}

.event-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.event-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.tag {
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
}

.category-tag {
  align-items: center;
  display: inline-flex;
  gap: 5px;
}

.category-tag .dot {
  background: var(--category-color);
}

.popup-category-dot {
  border-radius: 50%;
  display: inline-block;
  height: 8px;
  margin-right: 5px;
  width: 8px;
}

.event-distance {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  margin-top: 8px;
}

.event-address {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 6px;
}

.event-coordinates {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  margin-top: 6px;
}

.calendar-view {
  padding: 0 16px 24px;
}

.calendar-surface {
  position: absolute;
  inset: 0;
  overflow: auto;
  background: var(--surface);
  padding: 28px;
  z-index: 400;
}

.calendar-surface .calendar-toolbar,
.calendar-surface .calendar-weekdays,
.calendar-surface .calendar-grid {
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}

.calendar-surface .calendar-toolbar {
  margin-bottom: 14px;
}

.calendar-surface .calendar-day {
  min-height: 130px;
}

.data-surface {
  position: absolute;
  inset: 0;
  overflow: auto;
  background: var(--surface);
  padding: 28px;
  z-index: 400;
}

.data-page {
  min-width: 0;
}

.settings-page-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 36px 28px;
}

.settings-page-header {
  margin-bottom: 24px;
}

.settings-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.settings-section h2 {
  margin-bottom: 14px;
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 38px;
  font-size: 14px;
}

.settings-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.data-page-shell {
  min-height: 100vh;
  padding: 28px;
}

.data-page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  max-width: none;
  margin-bottom: 16px;
}

.data-page-header h1 {
  font-size: 28px;
}

.data-page-meta {
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0 0;
}

.data-page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.column-menu-control {
  position: relative;
}

.columns-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 10;
  display: grid;
  width: 220px;
  max-height: 380px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(23, 32, 42, 0.18);
  padding: 6px;
}

.column-menu-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border-radius: 5px;
  cursor: pointer;
  padding: 0 8px;
  font-size: 13px;
}

.column-menu-option:hover {
  background: #f1f5f9;
}

.column-menu-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.data-page-table-wrap {
  max-width: none;
  height: calc(100vh - 136px);
  position: relative;
}

.data-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  max-width: 1440px;
  margin: 0 auto 16px;
}

.data-toolbar h2 {
  font-size: 20px;
}

.data-table-wrap {
  max-width: 1440px;
  overflow: auto;
  margin: 0 auto;
  border: 1px solid var(--line);
  background: #fff;
}

.data-table {
  width: 100%;
  min-width: 1450px;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.data-table th,
.data-table td {
  max-width: 340px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.data-table th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  z-index: 1;
}

.data-page-table-wrap .data-table th {
  top: 0;
  z-index: 3;
}

.data-table th {
  position: sticky;
  top: 0;
  min-width: 90px;
  padding: 0;
}

.data-sort-button {
  width: 100%;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 8px 16px 8px 10px;
  text-align: left;
  text-transform: uppercase;
}

.data-table th[draggable="true"] {
  cursor: grab;
}

.data-table th[draggable="true"]:active {
  cursor: grabbing;
}

.data-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.data-truncate-cell {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  z-index: 2;
}

.column-resize-handle:hover {
  background: var(--accent);
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.calendar-toolbar h3 {
  margin: 0;
  text-align: center;
  font-size: 15px;
  text-transform: capitalize;
}

.calendar-nav {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}

.calendar-grid {
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.calendar-day {
  min-height: 94px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 5px;
  overflow: hidden;
}

.calendar-day.is-outside {
  background: #f8fafc;
}

.calendar-day.is-today .calendar-date {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}

.calendar-date {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.calendar-events {
  display: grid;
  gap: 3px;
}

.calendar-event {
  width: 100%;
  border: 0;
  border-left: 3px solid var(--event-color, var(--accent-2));
  border-radius: 0;
  background: color-mix(in srgb, var(--event-color, var(--accent-2)) 12%, white);
  color: var(--ink);
  cursor: pointer;
  font-size: 10px;
  line-height: 1.2;
  padding: 3px 4px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-day.is-outside .calendar-event {
  opacity: 0.45;
}

.calendar-more {
  color: var(--muted);
  font-size: 11px;
}

.map-wrap {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

#map {
  position: absolute;
  inset: 0;
}

.place-search-control {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 1200;
  width: min(520px, calc(100% - 32px));
}

.place-search-bar {
  display: flex;
  align-items: center;
  min-height: 56px;
  border: 1px solid rgba(217, 222, 231, 0.8);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.2);
  overflow: hidden;
}

.place-search-icon {
  display: grid;
  place-items: center;
  width: 50px;
  color: #4b5565;
  flex: 0 0 auto;
  font-size: 25px;
  line-height: 1;
}

.place-search-control input {
  width: 100%;
  min-width: 0;
  height: 54px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

.place-search-control input::-webkit-search-cancel-button {
  display: none;
}

.place-search-clear {
  width: 48px;
  height: 48px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 25px;
}

.place-search-control.is-searching .place-search-icon {
  animation: pulse-search 900ms ease-in-out infinite alternate;
}

.place-search-results {
  max-height: min(420px, calc(100dvh - 104px));
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.99);
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.22);
  overflow: auto;
  padding: 6px;
}

.place-search-result {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  width: 100%;
  min-height: 62px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 8px 10px 8px 6px;
  text-align: left;
}

.place-search-result:hover,
.place-search-result:focus-visible {
  background: #eef4ff;
  outline: none;
}

.place-result-pin {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f3f4;
  color: var(--accent);
  font-size: 11px;
}

.place-result-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.place-result-copy strong,
.place-result-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.place-result-copy strong {
  font-size: 14px;
}

.place-result-copy small,
.place-search-message {
  color: var(--muted);
  font-size: 12px;
}

.place-search-message {
  padding: 16px;
}

.map-notice {
  position: absolute;
  top: 84px;
  left: 16px;
  right: 16px;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
  z-index: 500;
  transition: opacity 160ms ease, transform 160ms ease;
}

.map-notice.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-5px);
}

.map-placement-hint {
  position: absolute;
  top: 126px;
  left: 16px;
  max-width: 300px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: #eef4ff;
  color: var(--accent);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  z-index: 500;
}

.map-wrap[data-view="calendar"] .map-style-control,
.map-wrap[data-view="calendar"] .attendance-legend,
.map-wrap[data-view="calendar"] .place-search-control,
.map-wrap[data-view="calendar"] .map-notice,
.map-wrap[data-view="calendar"] .map-placement-hint,
.map-wrap[data-view="data"] .map-style-control,
.map-wrap[data-view="data"] .attendance-legend,
.map-wrap[data-view="data"] .place-search-control,
.map-wrap[data-view="data"] .map-notice,
.map-wrap[data-view="data"] .map-placement-hint {
  display: none;
}

.home-marker-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid #d8562a;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 10px rgba(23, 32, 42, 0.24);
  color: #d8562a;
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
}

.map-style-control {
  position: absolute;
  bottom: 42px;
  left: 16px;
  z-index: 600;
}

.attendance-legend {
  bottom: 96px;
  left: 16px;
  position: absolute;
  z-index: 600;
}

.attendance-legend summary {
  align-items: center;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 7px;
  min-height: 36px;
  padding: 0 11px;
  user-select: none;
}

.attendance-legend summary::-webkit-details-marker {
  display: none;
}

.attendance-legend-panel {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: 10px;
  bottom: 44px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  color: var(--muted);
  display: grid;
  font-size: 11px;
  gap: 8px;
  left: 0;
  padding: 12px;
  position: absolute;
  width: 190px;
}

.attendance-legend-panel strong {
  color: var(--ink);
}

.attendance-legend-panel p {
  align-items: center;
  display: flex;
  gap: 8px;
  margin: 0;
}

.attendance-legend-scale {
  align-items: end;
  display: flex;
  justify-content: space-between;
}

.attendance-legend-scale span {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.attendance-legend-dot {
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.16);
  display: block;
}

.attendance-legend-dot.is-small { height: 14px; width: 14px; }
.attendance-legend-dot.is-medium { height: 20px; width: 20px; }
.attendance-legend-dot.is-large { height: 28px; width: 28px; }

.attendance-legend-ring {
  border: 2px solid var(--accent);
  border-radius: 50%;
  display: inline-block;
  height: 16px;
  width: 16px;
}

.attendance-legend-ring.is-dashed { border-style: dashed; }

.attendance-legend-star {
  color: #c88700;
  font-size: 14px;
  text-align: center;
  width: 16px;
}

.map-style-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  cursor: pointer;
  padding: 0 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  font-weight: 700;
}

.map-style-button span:first-child {
  font-size: 18px;
  line-height: 1;
}

.map-style-menu {
  position: absolute;
  bottom: 52px;
  left: 0;
  width: 220px;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  padding: 8px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}

.map-style-option {
  display: grid;
  gap: 2px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 10px;
}

.map-style-option:hover,
.map-style-option[aria-pressed="true"] {
  border-color: var(--accent);
  background: #eef4ff;
}

.map-style-option span {
  font-weight: 800;
}

.map-style-option small {
  color: var(--muted);
  line-height: 1.35;
}

.leaflet-popup-content {
  min-width: 220px;
}

.event-marker-icon,
.event-cluster-icon {
  background: transparent;
  border: 0;
}

.event-marker-dot {
  background: var(--marker-color);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.42);
  display: block;
  height: var(--marker-size, 18px);
  left: 12px;
  position: absolute;
  top: 12px;
  transform: translate(-50%, -50%);
  transition: height 160ms ease, width 160ms ease;
  width: var(--marker-size, 18px);
  z-index: 3;
}

.event-marker-icon.is-event-past .event-marker-dot,
.event-marker-icon.is-event-past .event-marker-importance {
  opacity: 0.5;
}

.event-marker-icon.is-event-happening .event-marker-dot {
  animation: happening-marker-pulse 1.8s ease-in-out infinite;
}

.event-marker-dot.attendance-ring::before,
.event-marker-dot.attendance-double-ring::before,
.event-marker-dot.attendance-double-ring::after {
  border: 2px solid var(--marker-color);
  border-radius: 50%;
  content: "";
  inset: -6px;
  opacity: 0.66;
  pointer-events: none;
  position: absolute;
}

.event-marker-dot.attendance-confidence-medium::before {
  border-style: dashed;
}

.event-marker-dot.attendance-confidence-low::before,
.event-marker-dot.attendance-confidence-low::after {
  display: none;
}

.event-marker-dot.attendance-double-ring::after {
  inset: -11px;
  opacity: 0.34;
}

.event-marker-importance {
  align-items: center;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 50%;
  color: #c88700;
  display: flex;
  font-size: 8px;
  height: 13px;
  justify-content: center;
  left: calc(12px + var(--importance-offset, 10px));
  line-height: 1;
  pointer-events: none;
  position: absolute;
  top: calc(12px - var(--importance-offset, 10px));
  transform: translate(-50%, -50%);
  width: 13px;
  z-index: 4;
}

.event-marker-label {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(100, 116, 139, 0.3);
  border-radius: 5px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
  color: #182132;
  display: block;
  font-size: 10px;
  font-weight: 750;
  left: 12px;
  line-height: 1.2;
  max-width: 180px;
  opacity: 0;
  overflow: hidden;
  padding: 3px 6px;
  pointer-events: none;
  position: absolute;
  top: 12px;
  transform: translate(-50%, -50%) translate(var(--label-x, 0), var(--label-y, -34px));
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms;
  visibility: hidden;
  white-space: nowrap;
  width: max-content;
  z-index: 5;
}

.event-marker-icon.is-label-visible .event-marker-label {
  opacity: 1;
  visibility: visible;
}

.event-marker-label-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-marker-label-details,
.event-marker-label-action {
  display: none;
}

.event-marker-label-details .event-timing,
.event-balloon-overlay-details .event-timing {
  margin: 4px 0 2px;
}

.event-marker-icon.is-label-expanded {
  z-index: 100000 !important;
}

.event-marker-icon.is-label-expanded .event-marker-label {
  border-color: color-mix(in srgb, var(--marker-color, #64748b) 35%, #cbd5e1);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.24);
  max-width: min(220px, calc(100vw - 32px));
  padding: 8px 10px;
  pointer-events: auto;
  white-space: normal;
  width: min(220px, calc(100vw - 32px));
  z-index: 100001;
}

.event-marker-icon.is-label-expanded .event-marker-label {
  opacity: 0 !important;
  pointer-events: none;
  visibility: hidden !important;
}

.event-balloon-overlay {
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--marker-color, #64748b) 35%, #cbd5e1);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
  color: #182132;
  padding: 8px 10px;
  pointer-events: auto;
  position: absolute;
  transform: translate(-50%, -100%);
  width: var(--balloon-width, 220px);
  z-index: 1000000;
}

.event-balloon-overlay[hidden] {
  display: none;
}

.event-balloon-overlay::after {
  background: #fff;
  border-bottom: 1px solid color-mix(in srgb, var(--marker-color, #64748b) 35%, #cbd5e1);
  border-right: 1px solid color-mix(in srgb, var(--marker-color, #64748b) 35%, #cbd5e1);
  bottom: -5px;
  content: "";
  height: 9px;
  left: 50%;
  position: absolute;
  transform: translateX(-50%) rotate(45deg);
  width: 9px;
}

.event-balloon-overlay-title {
  display: block;
  font-size: 12px;
  line-height: 1.25;
  margin-bottom: 5px;
}

.event-balloon-overlay-details {
  color: #5b6575;
  display: block;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
}

.event-balloon-overlay-action {
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font-size: 10px;
  font-weight: 850;
  margin-top: 6px;
  padding: 0;
}

.event-marker-icon.is-label-expanded .event-marker-label-title {
  font-size: 12px;
  line-height: 1.25;
  margin-bottom: 5px;
  white-space: normal;
}

.event-marker-icon.is-label-expanded .event-marker-label-details {
  color: #5b6575;
  display: block;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
}

.event-marker-icon.is-label-expanded .event-marker-label-action {
  color: var(--accent);
  cursor: pointer;
  display: inline-block;
  font-size: 10px;
  font-weight: 850;
  margin-top: 6px;
}

.event-marker-label-line {
  background: rgba(71, 85, 105, 0.62);
  height: 1px;
  left: 12px;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 12px;
  transform: rotate(var(--label-line-angle, -90deg));
  transform-origin: 0 50%;
  transition: opacity 140ms ease, width 140ms ease;
  width: var(--label-line-length, 14px);
  z-index: 2;
}

.event-marker-icon.is-label-visible .event-marker-label-line {
  opacity: 1;
}

.event-marker-icon.is-timeline-item .event-marker-dot {
  border-width: 2px;
}

.event-attendance-basis {
  background: #f7f9fc;
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 12px;
  padding: 10px 12px;
}

.event-attendance-basis ul {
  margin: 5px 0 0;
  padding-left: 18px;
}

.event-marker-icon.is-timeline-item .event-marker-label {
  border-color: rgba(100, 116, 139, 0.22);
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.14);
  font-size: 10.5px;
  padding: 4px 7px;
}

.event-marker-icon.is-timeline-item .event-marker-label-line {
  background: rgba(71, 85, 105, 0.72);
  height: 2px;
}

.event-marker-icon.is-timeline-item.is-label-expanded .event-marker-label {
  border-radius: 10px;
}

.event-cluster-ring {
  align-items: center;
  background: var(--cluster-colors);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.38);
  display: flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.event-cluster-ring strong {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 50%;
  color: #182132;
  display: flex;
  font-size: 13px;
  height: 28px;
  justify-content: center;
  line-height: 1;
  min-width: 28px;
  padding: 0 4px;
}

.leaflet-cluster-anim .leaflet-marker-icon,
.leaflet-cluster-spider-leg {
  transition: transform 180ms ease-out, opacity 180ms ease-out;
}

.popup-title {
  font-weight: 800;
  margin-bottom: 6px;
}

.popup-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.popup-admission {
  margin-top: 8px;
  padding: 6px 8px;
  border-left: 3px solid;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.popup-admission-price {
  border-color: #a54816;
  background: #fff1e8;
  color: #78300d;
}

.popup-admission-booking {
  border-color: #215a9e;
  background: #eaf3ff;
  color: #174779;
}

.popup-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent);
  font-weight: 700;
}

.popup-details-button {
  min-height: 36px;
  margin-top: 10px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  padding: 0 12px;
  font-weight: 800;
}

.mobile-view-nav {
  display: none;
}

.event-details-dialog {
  width: min(620px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  border: 0;
  border-radius: 16px;
  padding: 0;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.3);
}

.event-details-dialog::backdrop {
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(2px);
}

.event-details-sheet {
  position: relative;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 28px;
}

.details-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.event-details-kicker {
  margin: 0 52px 6px 0;
  color: var(--good);
  font-size: 13px;
  font-weight: 800;
}

.event-details-status {
  margin: 0 52px 10px 0;
}

.event-details-title {
  margin: 0 52px 20px 0;
  font-size: 26px;
  line-height: 1.15;
}

.event-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 20px;
}

.event-detail {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 11px 12px;
}

.event-detail dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.event-detail dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.event-details-summary {
  margin: 0 0 20px;
  color: #344054;
  line-height: 1.6;
}

.event-details-note {
  border-left: 3px solid #d89a2b;
  background: #fff8e7;
  margin: 0 0 20px;
  padding: 10px 12px;
  color: #6b4b10;
  font-size: 13px;
  line-height: 1.45;
}

.event-details-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.details-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  padding: 0 14px;
  font-weight: 700;
  text-decoration: none;
}

.details-action-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.details-share-status {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--good);
  font-size: 13px;
}

@media (max-width: 880px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    display: block;
    height: 100dvh;
    min-height: 0;
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  .map-wrap {
    height: 100%;
    min-height: 0;
  }

  .panel {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 0;
  }

  body[data-mobile-view="map"] .panel,
  body[data-mobile-view="list"] .map-wrap {
    display: none;
  }

  body[data-mobile-view="list"] .panel,
  body[data-mobile-view="map"] .map-wrap {
    display: flex;
  }

  body[data-mobile-view="map"] .map-wrap {
    display: block;
  }

  .mobile-view-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1400;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-height: calc(64px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.98);
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.1);
  }

  .mobile-view-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 800;
  }

  .mobile-view-button[aria-pressed="true"] {
    border-color: #bfd1f7;
    background: #eef4ff;
    color: var(--accent);
  }

  .map-notice {
    top: 84px;
  }
}

@media (max-width: 600px) {
  .app-shell {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  .map-wrap {
    min-height: 0;
  }

  .topbar {
    gap: 12px;
    padding: 16px 16px 12px;
  }

  h1 {
    font-size: 23px;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .view-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 0 16px 14px;
  }

  .nav-item {
    justify-content: center;
    min-height: 42px;
    padding: 0 8px;
    text-align: center;
  }

  .nav-group-label {
    display: none;
  }

  .status-strip {
    gap: 6px;
    padding: 0 16px 14px;
  }

  .status-strip div {
    padding: 8px;
  }

  .status-strip strong {
    font-size: 16px;
  }

  .controls {
    padding: 14px 16px;
  }

  .mini-button,
  .text-button,
  .view-button {
    min-height: 38px;
  }

  .list-header {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 16px 16px 10px;
  }

  .list-header h2 {
    padding-top: 7px;
  }

  .event-sort-control {
    justify-content: space-between;
    order: 3;
    width: 100%;
  }

  .event-sort-control select {
    flex: 1;
    max-width: 230px;
  }

  .event-list,
  .calendar-view {
    padding-left: 16px;
    padding-right: 16px;
  }

  .event-card {
    padding: 16px;
  }

  .calendar-surface,
  .data-surface {
    padding: 16px;
  }

  .calendar-surface .calendar-day {
    min-height: 74px;
  }

  .calendar-day {
    min-height: 74px;
    padding: 3px;
  }

  .calendar-date {
    font-size: 11px;
  }

  .calendar-event {
    border-left-width: 2px;
    font-size: 9px;
    padding: 2px 3px;
  }

  .map-notice {
    top: 80px;
    left: 12px;
    right: 12px;
    font-size: 13px;
  }

  .place-search-control {
    top: 12px;
    left: 12px;
    right: 12px;
    width: auto;
  }

  .place-search-bar {
    min-height: 54px;
    border-radius: 14px;
  }

  .place-search-control input {
    height: 52px;
    font-size: 15px;
  }

  .place-search-results {
    max-height: min(360px, calc(100dvh - 164px));
  }

  .map-placement-hint {
    top: 68px;
    left: 12px;
    right: 12px;
    max-width: none;
  }

  .map-style-control {
    bottom: 12px;
    left: 12px;
  }

  .attendance-legend {
    bottom: 68px;
    left: 12px;
  }

  .map-style-button {
    min-height: 44px;
  }

  .event-details-dialog {
    width: 100%;
    max-width: none;
    max-height: calc(92dvh - env(safe-area-inset-bottom));
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
  }

  .event-details-sheet {
    max-height: calc(92dvh - env(safe-area-inset-bottom));
    padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  }

  .event-details-grid {
    grid-template-columns: 1fr;
  }

  .event-details-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .details-action-primary {
    grid-column: 1 / -1;
  }
}

@keyframes pulse-search {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

@keyframes happening-marker-pulse {
  0%,
  100% {
    box-shadow: 0 2px 7px rgba(15, 23, 42, 0.42), 0 0 0 0 color-mix(in srgb, var(--marker-color) 44%, transparent);
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    box-shadow: 0 2px 7px rgba(15, 23, 42, 0.42), 0 0 0 9px color-mix(in srgb, var(--marker-color) 0%, transparent);
    transform: translate(-50%, -50%) scale(1.12);
  }
}

@media (prefers-reduced-motion: reduce) {
  .event-marker-icon.is-event-happening .event-marker-dot {
    animation: none;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.settings-page-shell {
  max-width: 840px;
}

.settings-page-header h1 {
  margin: 8px 0;
  font-size: clamp(30px, 5vw, 44px);
  letter-spacing: -0.04em;
}

.settings-intro {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.settings-back-link {
  display: inline-block;
  margin-bottom: 28px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.settings-page .settings-section {
  margin-bottom: 18px;
  padding: 22px;
  border-radius: 18px;
  box-shadow: 0 6px 22px rgba(23, 32, 42, 0.04);
}

.settings-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.settings-section-heading .eyebrow {
  margin: 0 0 5px;
}

.settings-section-heading h2 {
  margin: 0;
}

.source-count {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 800;
}

.evaluation-heading-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 9px;
}

.evaluation-start-button {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  padding: 0 13px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.evaluation-start-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.evaluation-worker-panel {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  margin: 12px 0 14px;
  padding: 13px 14px;
}

.evaluation-worker-heading {
  align-items: center;
  display: flex;
  gap: 8px;
}

.evaluation-worker-heading strong {
  font-size: 13px;
}

.evaluation-worker-heading > span:last-child {
  color: var(--muted);
  font-size: 11px;
  margin-left: auto;
}

.evaluation-worker-indicator {
  background: #98a2b3;
  border-radius: 50%;
  height: 9px;
  width: 9px;
}

.evaluation-worker-panel[data-state="running"] .evaluation-worker-indicator,
.evaluation-worker-panel[data-state="starting"] .evaluation-worker-indicator {
  animation: pulse-search 0.8s alternate infinite;
  background: var(--accent);
}

.evaluation-worker-panel[data-state="blocked"] .evaluation-worker-indicator {
  background: #d89a2b;
}

.evaluation-worker-panel[data-state="error"] .evaluation-worker-indicator {
  background: #b42318;
}

.evaluation-worker-panel > p {
  margin: 7px 0 0;
  color: #344054;
  font-size: 12px;
  line-height: 1.4;
}

.evaluation-worker-panel .evaluation-worker-detail {
  color: var(--muted);
  font-size: 11px;
}

.evaluation-progress-track {
  height: 6px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe5ed;
}

.evaluation-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 220ms ease;
}

.evaluation-worker-panel.is-active .evaluation-progress-track span {
  min-width: 12%;
  background: linear-gradient(90deg, #2f6fed 0%, #78a4ff 50%, #2f6fed 100%);
  background-size: 200% 100%;
  animation: evaluation-progress 1.2s linear infinite;
}

.evaluation-worker-panel[data-state="blocked"] .evaluation-progress-track span {
  background: #d89a2b;
}

@keyframes evaluation-progress {
  to { background-position: -200% 0; }
}

.source-inbox-form label {
  display: block;
  margin-bottom: 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.source-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.source-input-row input {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid #b8c1ce;
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.source-input-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.14);
}

.source-input-row button,
.source-card-actions button {
  min-height: 44px;
  border: 0;
  border-radius: 11px;
  padding: 0 17px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.source-input-row button:disabled,
.source-card-actions button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.source-form-status {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.source-form-status[data-kind="success"] { color: var(--good); }
.source-form-status[data-kind="warning"] { color: #9a6700; }
.source-form-status[data-kind="error"] { color: #b42318; }

.source-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 15px 0 20px;
  padding: 12px;
  border-radius: 12px;
  color: #344054;
  background: #f2f6ff;
  font-size: 13px;
  line-height: 1.45;
}

.source-notice > span {
  display: grid;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.source-notice p {
  margin: 1px 0 0;
}

.source-list,
.built-in-source-list {
  display: grid;
  gap: 10px;
}

.unified-source-list {
  min-width: 0;
  max-height: 620px;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 3px;
}

.source-empty {
  padding: 28px 16px;
  border: 1px dashed #c8d0dc;
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.source-empty > span {
  display: grid;
  width: 38px;
  height: 38px;
  margin: 0 auto 8px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: #edf3ff;
  font-size: 24px;
}

.source-empty strong {
  display: block;
  color: var(--ink);
}

.source-empty p {
  margin: 4px 0 0;
  font-size: 13px;
}

.source-empty-error {
  color: #b42318;
}

.source-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.source-link-row {
  display: flex;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
}

.source-link-copy {
  min-width: 0;
  flex: 1;
  color: var(--ink);
  text-decoration: none;
}

.source-link-copy strong,
.source-link-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-link-copy strong {
  font-size: 14px;
}

.source-link-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.source-city {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  color: #344054;
  background: #f2f4f7;
  font-size: 11px;
  font-weight: 800;
}

.source-inline-delete {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #667085;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.source-inline-delete:hover,
.source-inline-delete:focus-visible {
  color: #b42318;
  background: #fff1f0;
  outline: none;
}

.source-inline-delete:disabled {
  opacity: 0.45;
  cursor: wait;
}

.source-undo-toast {
  position: fixed;
  z-index: 5000;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: min(360px, calc(100vw - 28px));
  padding: 12px 13px 12px 16px;
  border-radius: 12px;
  color: #fff;
  background: #202124;
  box-shadow: 0 8px 28px rgba(16, 24, 40, 0.28);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.source-undo-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.source-undo-toast span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.source-undo-toast button {
  border: 0;
  padding: 7px 9px;
  color: #8ab4f8;
  background: transparent;
  font-weight: 900;
  cursor: pointer;
}

.source-card-main,
.built-in-source {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.source-site-icon {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  color: #2859b8;
  background: #edf3ff;
  font-size: 11px;
  font-weight: 900;
}

.source-card-copy {
  min-width: 0;
  flex: 1;
}

.source-card-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.source-card-title-row a {
  overflow: hidden;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-card-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.source-card-copy .source-error {
  color: #9a6700;
}

.source-status {
  padding: 4px 7px;
  border-radius: 999px;
  color: #475467;
  background: #f2f4f7;
  font-size: 10px;
  font-weight: 900;
}

.source-origin {
  padding: 4px 7px;
  border-radius: 999px;
  color: #2859b8;
  background: #edf3ff;
  font-size: 10px;
  font-weight: 900;
}

.source-status-active { color: #067647; background: #ecfdf3; }
.source-status-error { color: #b42318; background: #fef3f2; }
.source-status-access-blocked,
.source-status-no-events { color: #9a6700; background: #fffaeb; }
.source-status-queued,
.source-status-processing { color: #2859b8; background: #edf3ff; }

.source-card-actions {
  display: flex;
  gap: 8px;
  margin: 13px 0 0 50px;
}

.source-card-actions button {
  min-height: 36px;
  padding: 0 12px;
  color: #344054;
  background: #f2f4f7;
  font-size: 12px;
}

.source-card-actions .source-remove-button {
  color: #b42318;
  background: #fff1f0;
}

.built-in-source {
  align-items: center;
  padding: 11px;
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
  text-decoration: none;
}

.built-in-source > span:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.built-in-source strong,
.built-in-source small {
  display: block;
}

.evaluation-form label {
  display: block;
  margin-bottom: 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.evaluation-form textarea {
  display: block;
  width: 100%;
  min-height: 112px;
  resize: vertical;
  padding: 13px 15px;
  border: 1px solid #b8c1ce;
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  line-height: 1.5;
  outline: none;
}

.evaluation-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.14);
}

.evaluation-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.evaluation-input-row textarea {
  min-height: 96px;
}

.evaluation-input-row button {
  min-width: 156px;
  border: 0;
  border-radius: 12px;
  padding: 0 18px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.evaluation-input-row button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.evaluation-submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
}

.evaluation-submit-row p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.evaluation-submit-row button,
.evaluation-item button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.evaluation-submit-row button:disabled,
.evaluation-item button:disabled {
  opacity: 0.55;
}

.evaluation-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.evaluation-stats span {
  padding: 10px 8px;
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface);
  font-size: 11px;
  text-align: center;
}

.evaluation-stats strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 17px;
}

.evaluation-list {
  display: grid;
  gap: 8px;
  max-height: 480px;
  overflow: auto;
}

.evaluation-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.evaluation-state-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: #98a2b3;
}

.evaluation-item-processing .evaluation-state-dot { background: var(--accent); animation: pulse-search 0.8s alternate infinite; }
.evaluation-item-completed .evaluation-state-dot { background: var(--good); }
.evaluation-item-failed .evaluation-state-dot { background: #b42318; }

.evaluation-item-heading {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.evaluation-item-heading a {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.evaluation-item-heading span,
.evaluation-item small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}

.evaluation-item p {
  margin: 4px 0 0;
  color: #475467;
  font-size: 12px;
  line-height: 1.4;
}

.evaluation-item button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 11px;
}

.built-in-source small {
  margin-top: 2px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .settings-page-shell {
    padding: 22px 12px calc(30px + env(safe-area-inset-bottom));
  }

  .settings-back-link {
    margin-bottom: 22px;
  }

  .settings-page .settings-section {
    padding: 17px;
    border-radius: 15px;
  }

  .settings-section-heading,
  .evaluation-heading-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .evaluation-start-button {
    min-height: 44px;
  }

  .source-input-row {
    grid-template-columns: 1fr;
  }

  .evaluation-input-row {
    grid-template-columns: 1fr;
  }

  .evaluation-input-row button {
    min-height: 48px;
    width: 100%;
  }

  .source-input-row button {
    min-height: 48px;
  }

  .source-card-actions {
    margin-left: 0;
  }

  .source-card-actions button {
    flex: 1;
  }

  .evaluation-submit-row {
    align-items: stretch;
    flex-direction: column;
  }

  .evaluation-submit-row button {
    width: 100%;
  }

  .evaluation-stats {
    grid-template-columns: 1fr 1fr;
  }

  .evaluation-item-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
