:root {
  --brand: #0a6970;
  --brand-strong: #07484d;
  --on-brand: #ffffff;
  --brand-soft: #d2ebe9;
  --on-brand-soft: #093c40;
  --bg: #eef3f2;
  --surface: #ffffff;
  --surface-2: #e2ebea;
  --line: #c6d3d2;
  --text: #13262b;
  --muted: #4b5b5e;
  --warn-bg: #ffdcbd;
  --warn-text: #4f2700;
  --error: #a3261f;
  --shadow: 0 1px 2px rgb(19 38 43 / 8%), 0 1px 6px rgb(19 38 43 / 6%);
  --radius: 18px;
  --tabs-h: 64px;
  color-scheme: light;

  --f-aa: #dce4ff; --f-aa-text: #1b3a8a;
  --f-na: #d0ecd2; --f-na-text: #1c5a26;
  --f-refuge: #ffe3bd; --f-refuge-text: #6f3b00;
  --f-dharma: #f2ddf4; --f-dharma-text: #642a6c;
  --f-cma: #ffdcd8; --f-cma-text: #85201a;
  --f-smart: #d4eef6; --f-smart-text: #0b5063;
  --f-wellbriety: #f0e4cc; --f-wellbriety-text: #584015;
  --f-alanon: #fbdce8; --f-alanon-text: #831843;
  --f-other: #e1e5e5; --f-other-text: #39464a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #7fd3d6;
    --brand-strong: #a6e6e8;
    --on-brand: #00373a;
    --brand-soft: #1f4a4d;
    --on-brand-soft: #c6eeee;
    --bg: #0d1415;
    --surface: #172021;
    --surface-2: #233031;
    --line: #3a4a4b;
    --text: #dfe8e8;
    --muted: #b3c3c3;
    --warn-bg: #5a3510;
    --warn-text: #ffdcbd;
    --error: #ffb4ab;
    --shadow: none;
    color-scheme: dark;

    --f-aa: #2b3a66; --f-aa-text: #d9e1ff;
    --f-na: #1f4426; --f-na-text: #c9ecce;
    --f-refuge: #573611; --f-refuge-text: #ffe0b8;
    --f-dharma: #4c2852; --f-dharma-text: #f6d9f8;
    --f-cma: #5c2420; --f-cma-text: #ffd9d4;
    --f-smart: #153f4b; --f-smart-text: #cdeef7;
    --f-wellbriety: #4a3b1d; --f-wellbriety-text: #f2e3c4;
    --f-alanon: #5a1d38; --f-alanon-text: #fbd6e6;
    --f-other: #333c3e; --f-other-text: #dbe2e3;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0 auto;
  max-width: 760px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 16px);
}

body[data-view="detail"], body[data-view="about"] { padding-bottom: calc(env(safe-area-inset-bottom) + 32px); }

a { color: var(--brand); }
h1, h2, h3 { margin: 0; }
p { margin: 0; }
button { font: inherit; color: inherit; }

.icon { width: 24px; height: 24px; fill: currentColor; flex: none; }
.icon.tiny { width: 16px; height: 16px; }
.icon.brand, .brand { color: var(--brand); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ---- Top bar ---- */

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 8px 20px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.top h1 { flex: 1; font-size: 26px; font-weight: 500; letter-spacing: -0.3px; }
.detail-top { padding-left: 8px; }
.detail-top h1 { font-size: 22px; }
.top-actions { display: flex; gap: 2px; margin-left: auto; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.brand { color: var(--brand); }
.fav.on { color: #c2185b; }
@media (prefers-color-scheme: dark) { .fav.on { color: #ff8fb8; } }

.search-row { padding: 0 16px 8px; }
.search-row input, .field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

/* ---- Area bar and chips ---- */

.area-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 4px 16px 10px;
  padding-right: 6px;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.area-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 10px 8px 10px 18px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.area-text { flex: 1; display: grid; }
.area-text strong { font-size: 17px; font-weight: 600; }
.area-text small { color: var(--muted); font-size: 14px; }

.chips {
  display: flex;
  gap: 8px;
  padding: 2px 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; padding-left: 0; padding-right: 0; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
}
.chip.on { border-color: transparent; background: var(--brand-soft); color: var(--on-brand-soft); font-weight: 600; }

.lang-row { display: flex; align-items: center; gap: 12px; padding: 0 16px 6px; }
.pad { padding: 0 16px 6px; }

/* ---- Lists ---- */

.list { display: grid; gap: 10px; padding: 4px 16px 8px; }

.section { margin: 10px 2px 0; color: var(--brand); font-size: 16px; font-weight: 600; }

.card {
  position: relative;
  display: flex;
  align-items: flex-start;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card.dim { opacity: 0.6; }
.card-main {
  flex: 1;
  display: flex;
  gap: 16px;
  min-width: 0;
  padding: 16px 0 16px 18px;
  color: inherit;
  text-decoration: none;
}
.card .fav { margin: 8px 6px 0 0; }
.when { display: grid; align-content: start; width: 64px; flex: none; }
.when .hm { font-size: 23px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.when .ap, .when .tz { color: var(--muted); font-size: 14px; font-weight: 600; }
.what { min-width: 0; display: grid; gap: 3px; }
.what h3 { font-size: 18px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.where { color: var(--muted); }
.status { color: var(--brand); font-weight: 600; }
.status.closed { color: var(--error); }
.group-times { margin-top: 10px; }
.group-times ul { margin: 4px 0 0; padding-left: 20px; display: grid; gap: 2px; }
.strong { font-weight: 600; }
.types { color: var(--muted); font-size: 14px; }

.badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  background: var(--f-other);
  color: var(--f-other-text);
}
.badge.wide { font-size: 15px; padding: 4px 10px; }
.f-aa { background: var(--f-aa); color: var(--f-aa-text); }
.f-na { background: var(--f-na); color: var(--f-na-text); }
.f-refuge { background: var(--f-refuge); color: var(--f-refuge-text); }
.f-dharma { background: var(--f-dharma); color: var(--f-dharma-text); }
.f-cma { background: var(--f-cma); color: var(--f-cma-text); }
.f-smart { background: var(--f-smart); color: var(--f-smart-text); }
.f-wellbriety { background: var(--f-wellbriety); color: var(--f-wellbriety-text); }
.f-alanon { background: var(--f-alanon); color: var(--f-alanon-text); }
.att { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; }

.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 14px 16px 14px 18px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--on-brand-soft);
}
.notice.warn { background: var(--warn-bg); color: var(--warn-text); }
.notice > div:first-child { flex: 1 1 220px; display: grid; gap: 2px; }
.notice h3 { font-size: 16px; }
.notice p { font-size: 14px; }
.notice-actions { display: flex; gap: 4px; margin-left: auto; }
.notice .text-btn { color: inherit; }

.welcome, .empty {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 22px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.welcome { background: var(--brand-soft); color: var(--on-brand-soft); }
.welcome h2, .empty h2 { font-size: 20px; }
.empty { justify-items: center; text-align: center; color: var(--muted); }
.empty h2 { color: var(--text); }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.pre { white-space: pre-line; overflow-wrap: anywhere; }
.warn-text { color: var(--error); }

.foot { display: grid; gap: 6px; margin: 14px 2px 0; color: var(--muted); font-size: 14px; }
.foot > a { font-weight: 600; font-size: 15px; }

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn .icon { width: 20px; height: 20px; }
.btn.tonal { background: var(--brand-soft); color: var(--on-brand-soft); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.6; }
.text-btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.list > .text-btn { justify-self: start; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.about h3 { font-size: 16px; margin-top: 8px; }
.plain-list { margin: 4px 0 12px; padding-left: 20px; display: grid; gap: 6px; }
.link { font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }

/* ---- Bottom tabs ---- */

.tabs {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 6;
  transform: translateX(-50%);
  display: flex;
  width: 100%;
  max-width: 760px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--surface-2);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.tab .icon { width: 56px; height: 30px; padding: 3px 0; border-radius: 15px; }
.tab.on { color: var(--text); }
.tab.on .icon { background: var(--brand-soft); color: var(--on-brand-soft); }

/* ---- Meeting detail ---- */

.detail { display: grid; gap: 22px; padding: 4px 20px 24px; }
.detail-name { font-size: 28px; font-weight: 500; line-height: 1.2; overflow-wrap: anywhere; }
.d-section { display: flex; gap: 16px; }
.d-section > div { flex: 1; min-width: 0; display: grid; gap: 8px; justify-items: start; }
.d-section h2 { color: var(--brand); font-size: 15px; font-weight: 600; }
.big { font-size: 18px; }
.strong { font-weight: 600; }
.accent { color: var(--brand); font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { padding: 6px 10px; border-radius: 8px; background: var(--surface-2); font-size: 15px; font-weight: 500; }

/* ---- Lists and help ---- */

.about { display: grid; gap: 14px; padding: 4px 16px 24px; }
.card-block { display: grid; gap: 10px; padding: 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card-block h2 { font-size: 18px; }
.crisis { background: var(--brand-soft); color: var(--on-brand-soft); }
.source-list { list-style: none; margin: 0; padding: 0; display: grid; }
.source-list li { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.source-list li:first-child { border-top: 0; }
.source-list li > div { flex: 1; display: grid; gap: 1px; min-width: 0; }
.source-list small { color: var(--muted); font-size: 14px; }

/* ---- Sheets (dialogs) ---- */

dialog.sheet {
  width: min(560px, 100vw);
  max-width: 100vw;
  max-height: min(88vh, 760px);
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 -4px 24px rgb(0 0 0 / 20%);
}
@media (min-width: 600px) {
  dialog.sheet { margin: auto; border-radius: 24px; }
}
dialog.sheet::backdrop { background: rgb(0 0 0 / 45%); }
.sheet-body { display: grid; gap: 12px; padding: 16px 20px calc(20px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: center; gap: 8px; }
.sheet-head h2 { flex: 1; font-size: 21px; font-weight: 600; }
.sheet-body h3 { font-size: 15px; color: var(--brand); margin-top: 4px; }
.sheet-actions { display: flex; justify-content: flex-end; }
.field { position: relative; display: block; }
.field .icon { position: absolute; left: 12px; top: 12px; color: var(--muted); }
.field input { padding-left: 44px; }
.suggestions { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.suggestion, .menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.suggestion:hover, .menu-item:hover { background: var(--surface-2); }
.suggestion .icon, .menu-item .icon { color: var(--brand); }
.error { color: var(--error); }
.line { display: grid; gap: 4px; padding: 6px 0; }
.line-head { display: flex; align-items: center; gap: 8px; }
.call { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; font-weight: 600; text-decoration: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }

/* ---- Toast ---- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 20px);
  z-index: 20;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: #1f2b2d;
  color: #eef6f6;
  font-size: 15px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Tonal buttons on tinted cards need their own background to stand out. */
.welcome .btn.tonal, .crisis .btn.tonal { background: var(--surface); color: var(--text); }
.list > .more { justify-self: center; margin-top: 4px; }

/* Help-test page */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.step { display: flex; gap: 14px; padding: 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.step > div { display: grid; gap: 8px; min-width: 0; }
.step h3 { font-size: 17px; }
.step-n { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--on-brand); font-weight: 700; }

/* ======================================================================================
   Wide screens (1100px and up): a top bar, filters above the list ("top", the default) or in
   a column ("side"), the list, and the map on the right with the open meeting under it.
   Every divider drags. Phones keep the layout above.
   ====================================================================================== */

.card-actions, .addr { display: none; }

@media (min-width: 1100px) {
  body[data-layout="desk"] { max-width: none; padding: 0; overflow: hidden; font-size: 15px; }
  body[data-layout="desk"][data-view="about"],
  body[data-layout="desk"][data-view="get"] { max-width: 820px; padding: 24px 24px 48px; overflow: auto; font-size: 16px; }

  .desk {
    --w-filters: 280px;
    --w-side: clamp(380px, 36vw, 720px);
    --h-map: 46%;
    display: grid;
    height: 100vh;
    height: 100dvh;
    grid-template-rows: 60px auto minmax(0, 1fr);
    grid-template-columns: var(--w-filters) 8px minmax(380px, 1fr) 8px var(--w-side);
    grid-template-areas:
      "top top top top top"
      "bar bar bar bar bar"
      "filters s1 list s2 side";
  }
  .desk[data-mode="top"] { grid-template-columns: 0 0 minmax(420px, 1fr) 8px var(--w-side); }
  .desk[data-mode="top"] .dfilters, .desk[data-mode="top"] [data-split="filters"] { display: none; }
  .desk[data-mode="side"] .dbar { display: none; }
  /* Online with nothing open: no map to show, so the list takes the room. */
  .desk[data-map="false"][data-detail="false"] { grid-template-columns: var(--w-filters) 8px minmax(380px, 1fr) 0 0; }
  .desk[data-mode="top"][data-map="false"][data-detail="false"] { grid-template-columns: 0 0 minmax(420px, 1fr) 0 0; }
  .desk[data-map="false"][data-detail="false"] .dside,
  .desk[data-map="false"][data-detail="false"] [data-split="side"] { display: none; }

  .dtop { grid-area: top; }
  .dbar { grid-area: bar; }
  .dfilters { grid-area: filters; }
  [data-split="filters"] { grid-area: s1; }
  .dlist { grid-area: list; }
  [data-split="side"] { grid-area: s2; }
  .dside { grid-area: side; }

  /* ---- Top bar ---- */
  .dtop { display: flex; align-items: center; gap: 18px; min-width: 0; padding: 0 14px 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .dbrand { display: flex; align-items: center; gap: 10px; flex: none; color: var(--brand); text-decoration: none; font-size: 20px; font-weight: 700; letter-spacing: -0.3px; white-space: nowrap; }
  .dlogo { width: 28px; height: 28px; }
  .dtabs { display: flex; gap: 2px; flex: none; }
  .dtab { display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap; }
  .dtab .icon { width: 19px; height: 19px; }
  .dtab:hover { background: var(--surface-2); color: var(--text); }
  .dtab.on { background: var(--brand-soft); color: var(--on-brand-soft); }
  .dsearch { flex: 1; min-width: 160px; max-width: 560px; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 16px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
  .dsearch:focus-within { box-shadow: 0 0 0 2px var(--brand); }
  .dsearch input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; }
  .dtop-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; flex: none; }
  .dtop-actions .btn { min-height: 38px; padding: 6px 14px; }

  /* ---- Filter bar (top layout) ---- */
  .dbar { display: grid; gap: 8px; min-width: 0; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .brow { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .brow > .muted { font-size: 14px; }
  .bchips { display: flex; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .bchips::-webkit-scrollbar { display: none; }
  .bchip { display: inline-flex; align-items: center; gap: 6px; flex: none; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; }
  .bchip:hover { background: var(--surface-2); }
  .bchip.on { border-color: transparent; background: var(--brand-soft); color: var(--on-brand-soft); }
  .bchip small { color: var(--muted); font-size: 11.5px; font-weight: 500; opacity: 0.85; }
  .bchip.on small { color: inherit; opacity: 0.8; }
  .crisis-chip { margin-left: auto; border-color: transparent; background: transparent; color: var(--brand); }
  .bplace { display: inline-flex; align-items: center; gap: 8px; flex: none; max-width: 320px; height: 38px; padding: 0 12px 0 10px; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; }
  .bplace strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bplace > span { color: var(--muted); font-weight: 600; }
  .brow .fseg { flex: none; margin: 0 0 0 auto; }
  .bmore { position: relative; flex: none; }
  .bmore > summary { list-style: none; }
  .bmore > summary::-webkit-details-marker { display: none; }
  .bmenu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; display: grid; gap: 2px; width: 300px; max-height: 60vh; overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 10px 30px rgb(0 0 0 / 22%); }
  .bmenu .text-btn { justify-self: end; }

  /* ---- Filter column (side layout) ---- */
  .dfilters { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 4px; overflow-y: auto; overflow-x: hidden; padding: 12px 10px 32px; background: var(--surface); }
  .fbox { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 8px 2px 12px; border-bottom: 1px solid var(--line); }
  .fbox:last-child { border-bottom: 0; }
  .fbox-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 6px 6px; }
  .fbox h2 { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; }
  .frow { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 5px 10px; border: 0; border-radius: 10px; background: transparent; font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
  .frow:hover { background: var(--surface-2); }
  .frow.on { background: var(--brand-soft); color: var(--on-brand-soft); font-weight: 600; }
  .flabel { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .fcount { color: var(--muted); font-size: 12px; font-weight: 500; opacity: 0.85; font-variant-numeric: tabular-nums; }
  .frow.on .fcount { color: inherit; }
  .fdot { flex: none; width: 11px; height: 11px; border-radius: 50%; }
  .fcheck { display: grid; place-items: center; flex: none; width: 18px; height: 18px; border: 1.5px solid var(--line); border-radius: 5px; }
  .frow.on .fcheck { border-color: currentColor; }
  .fradio { flex: none; width: 16px; height: 16px; border: 1.5px solid var(--line); border-radius: 50%; }
  .frow.on .fradio { border: 5px solid currentColor; }
  .fnote { margin: 6px 10px 0; }
  .farea { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: 12px; background: var(--surface-2); font: inherit; text-align: left; cursor: pointer; }
  .farea span { display: grid; min-width: 0; }
  .farea strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .farea small { color: var(--brand); font-size: 13px; font-weight: 600; }
  .fseg { display: flex; gap: 2px; margin-top: 8px; padding: 3px; border-radius: 999px; background: var(--surface-2); }
  .fseg.small { margin: 0; }
  .fseg button { flex: 1 1 0; min-width: 0; min-height: 30px; padding: 4px 10px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; }
  .fseg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
  .fbtns { display: grid; gap: 8px; margin-top: 10px; }
  .flines { display: grid; gap: 8px; margin: 0; padding: 0 6px; list-style: none; font-size: 14px; }
  .flines li { display: grid; }
  .flines a { font-weight: 600; text-decoration: none; }

  /* ---- Dividers ---- */
  .dsplit { position: relative; z-index: 3; touch-action: none; outline: none; background: var(--surface); }
  .dsplit::after { content: ""; position: absolute; background: var(--line); transition: background 0.15s; }
  .dsplit::before { content: ""; position: absolute; z-index: 1; top: 50%; left: 50%; border-radius: 2px; background: var(--muted); opacity: 0.45; transition: opacity 0.15s; }
  .dsplit.v { cursor: col-resize; }
  .dsplit.v::after { top: 0; bottom: 0; left: 3px; width: 2px; }
  .dsplit.v::before { width: 4px; height: 34px; margin: -17px 0 0 -2px; }
  .dsplit.h { cursor: row-resize; }
  .dsplit.h::after { left: 0; right: 0; top: 3px; height: 2px; }
  .dsplit.h::before { width: 34px; height: 4px; margin: -2px 0 0 -17px; }
  .dsplit:hover::after, .dsplit:focus-visible::after { background: var(--brand); }
  .dsplit:hover::before, .dsplit:focus-visible::before { opacity: 1; background: var(--brand); }
  body.dragging { user-select: none; }
  body.dragging .dmap { pointer-events: none; }

  /* ---- The list ---- */
  .dlist { container-type: inline-size; display: grid; align-content: start; gap: 8px; min-width: 0; overflow-y: auto; padding: 14px 20px 48px; background: var(--bg); }
  .dlist .section { margin: 12px 2px 0; font-size: 15px; }
  .dlist .card { align-items: center; border: 1px solid transparent; border-radius: 14px; transition: border-color 0.15s, box-shadow 0.15s; }
  .dlist .card:hover { border-color: var(--line); }
  .dlist .card.sel { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
  .dlist .card-main { gap: 16px; padding: 12px 0 12px 16px; }
  .dlist .when { width: 64px; }
  .dlist .when .hm { font-size: 20px; }
  .dlist .what { gap: 2px; }
  .dlist .what h3 { font-size: 16px; }
  .dlist .where, .dlist .addr, .dlist .types { font-size: 14px; }
  .dlist .addr { display: block; color: var(--muted); }
  .card-actions { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 0 4px 0 10px; }
  .mini { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: var(--brand-soft); color: var(--on-brand-soft); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
  .mini:hover { filter: brightness(0.96); }
  .dlist .card .fav { align-self: center; margin: 0 8px 0 0; }
  .dlist .welcome, .dlist .empty, .dlist .notice, .dlist > p { max-width: 900px; }
  .desk .tabs { display: none; }

  /* With room, a meeting reads across: what and when on the left, where and its kind on the right. */
  @container (min-width: 720px) {
    .dlist .what { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; column-gap: 28px; row-gap: 2px; }
    .dlist .what > .badges { grid-column: 1; grid-row: 1; }
    .dlist .what > h3 { grid-column: 1; grid-row: 2; }
    .dlist .what > .status { grid-column: 1; grid-row: 3; }
    .dlist .what > .where { grid-column: 2; grid-row: 1; color: var(--text); font-weight: 600; }
    .dlist .what > .addr { grid-column: 2; grid-row: 2; }
    .dlist .what > .types { grid-column: 2; grid-row: 3; }
    .dlist .card-actions { flex-direction: row; }
  }

  /* ---- Week ---- */
  .week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: start; gap: 8px; }
  .wcol { display: grid; gap: 2px; padding: 8px 6px 10px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
  .wcol.on { box-shadow: 0 0 0 2px var(--brand); }
  .wcol h3 { display: grid; margin: 0 4px 6px; font-size: 15px; line-height: 1.2; }
  .wcol h3 small { color: var(--muted); font-size: 12px; font-weight: 500; }
  .wholiday { margin: 0 4px 6px; padding: 2px 6px; border-radius: 6px; background: var(--warn-bg); color: var(--warn-text); font-size: 12px; font-weight: 600; }
  .witem { display: grid; grid-template-columns: 8px minmax(0, 1fr); column-gap: 6px; padding: 5px 6px; border-radius: 8px; color: inherit; text-decoration: none; font-size: 13px; line-height: 1.25; }
  .witem .wtime { grid-column: 1 / -1; font-size: 12px; }
  .witem:hover { background: var(--surface-2); }
  .witem.sel { background: var(--brand-soft); color: var(--on-brand-soft); }
  .witem.closed { opacity: 0.55; text-decoration: line-through; }
  .wtime { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .wdot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; }
  .wname { min-width: 0; overflow-wrap: break-word; hyphens: auto; }

  /* ---- Map and the open meeting ---- */
  .dside { display: grid; grid-template-rows: minmax(0, 1fr) 0 0; min-width: 0; min-height: 0; background: var(--surface); }
  .desk[data-detail="true"] .dside { grid-template-rows: var(--h-map) 8px minmax(0, 1fr); }
  .desk[data-detail="false"] [data-split="map"], .desk[data-detail="false"] .ddetail { display: none; }
  .desk[data-map="false"] .dside { grid-template-rows: minmax(0, 1fr); }
  .desk[data-map="false"] .dmap, .desk[data-map="false"] [data-split="map"] { display: none; }
  .dmap { position: relative; min-height: 0; background: var(--surface-2); }
  .map-off { padding: 24px; color: var(--muted); }
  .ddetail { min-height: 0; overflow-y: auto; }
  .dd-bar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 4px 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .ddetail .detail { gap: 16px; padding: 14px 20px 32px; }
  .ddetail .detail-name { font-size: 23px; }
  .dempty { display: grid; gap: 10px; padding: 28px 24px; }
  .dempty h2 { font-size: 19px; }
  .pin-tip .maplibregl-popup-content { padding: 6px 10px; border-radius: 8px; background: var(--surface); color: var(--text); font: 600 13px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif; box-shadow: var(--shadow); }
  .pin-tip .maplibregl-popup-tip { border-top-color: var(--surface); border-bottom-color: var(--surface); }
  .toast { bottom: 24px; }
}

/* Laptops and scaled screens (about 1100 to 1360 wide). */
@media (min-width: 1100px) and (max-width: 1360px) {
  .desk { --w-filters: 248px; --w-side: clamp(320px, 33vw, 520px); }
  .dtop { gap: 12px; }
  .dtab { padding: 8px 11px; }
  .dtop-actions .btn span { display: none; }
  .dtop-actions .btn { padding: 6px 10px; }
}
