/* Mensaful: information dense, bare bones, flat. */
:root {
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e2e2e2;
  --line-strong: #c8c8c8;
  --bg: #ffffff;
  --soft: #f6f6f6;
  --accent: #2456d6;
  --error: #c62828;
  --radius: 4px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0 auto; max-width: 1100px; padding: 8px 16px;
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--fg); background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--line); }
h1 { font-size: 22px; font-weight: 600; margin: 0; }
p { margin: 0; }

.shadow, [hidden] { display: none !important; }

/* Layout */
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.row.top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 6px; }
.grow { flex: 1 1 0; min-width: 0; }
.spacer { flex: 1 1 auto; }
.pad { padding: 8px 10px; }
.muted { color: var(--muted); }
.error { color: var(--error); }
.error:empty { display: none; }

/* Controls */
button {
  font: inherit; font-size: 12px; color: var(--fg); padding: 3px 10px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
button:hover { background: var(--soft); }
button.active { background: var(--fg); border-color: var(--fg); color: #fff; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.1); }
button:disabled { opacity: .45; cursor: default; background: var(--bg); filter: none; }
button.primary:disabled { background: var(--accent); }
input, select, textarea {
  font: inherit; color: var(--fg); background: var(--bg); padding: 4px 6px; max-width: 100%;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; }
input.short { width: 110px; }
.form label, .field-label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.form label > *, .field-label > * { color: var(--fg); font-size: 13px; }
label.inline { display: inline-flex; flex-direction: row; align-items: center; gap: 4px; }
.buttons { justify-content: flex-end; }

/* Chrome */
.header { border-bottom: 1px solid var(--line); padding: 6px 0 8px; }
.brand { text-decoration: none !important; }
.logo { font-size: 20px; font-weight: 700; color: var(--fg); letter-spacing: -.3px; }
.tagline { color: var(--muted); font-style: normal; }
.footer { margin-top: 16px; font-size: 11px; color: var(--muted); text-align: center; padding-bottom: 8px; }
.box { border: 1px solid var(--line); border-radius: var(--radius); margin-top: 10px; background: var(--bg); overflow: hidden; }
.bar { font-weight: 600; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--soft); }
.bar small { font-weight: normal; color: var(--muted); }
.narrow { max-width: 340px; margin: 40px auto 0; }
.narrow .form { padding: 10px; }
.switch { font-size: 12px; color: var(--muted); text-align: center; padding-top: 4px; }
.location-val { padding: 4px 0; }

/* Calendar */
.cal-title { font-size: 14px; font-weight: 600; margin-left: 6px; }
.cal-grid { border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-row { gap: 0; flex-wrap: nowrap; align-items: stretch; }
.cal-cell {
  flex: 1 1 0; min-width: 0; padding: 2px 4px; overflow: hidden;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.cal-head .cal-cell { background: var(--soft); color: var(--muted); font-weight: 600; text-align: center; font-size: 11px; }
.cal-grid.month .cal-row:not(.cal-head) .cal-cell { min-height: 72px; }
.cal-grid.week .cal-row:not(.cal-head) .cal-cell { min-height: 170px; }
.cal-cell.other { background: #fafafa; color: #b0b0b0; }
.cal-cell.today { background: #eef3ff; }
.cal-cell.today .cal-date { color: var(--accent); }
.cal-date { font-size: 11px; font-weight: 600; }
.ev {
  display: block; font-size: 11px; font-weight: 600; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ev-time { font-weight: normal; color: var(--muted); }
.cal-grid.week .ev { white-space: normal; margin-bottom: 3px; }
.ev.full { color: #aaa !important; font-weight: normal; }
.ev-full {
  padding: 0 3px; border: 1px solid currentColor; border-radius: 3px;
  font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; vertical-align: 1px;
}

.preview {
  position: fixed; z-index: 100; max-width: 300px; padding: 6px 8px; font-size: 12px; pointer-events: none;
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
}
.preview-meta { color: var(--muted); font-size: 11px; }

/* List */
.list-head, .list-row { gap: 0; flex-wrap: nowrap; padding: 4px 0; border-bottom: 1px solid var(--line); }
.list-head { font-size: 11px; font-weight: 600; color: var(--muted); }
.list-head > *, .list-row > * { padding: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row:hover { background: var(--soft); }
.list-row.full, .list-row.full a { color: #aaa; }
.c-date { flex: 0 0 130px; }
.c-time { flex: 0 0 72px; }
.c-cat { flex: 0 0 150px; }
.c-head { flex: 2 1 0; min-width: 0; font-weight: 600; }
.c-loc { flex: 1 1 0; min-width: 0; }
.c-going { flex: 0 0 110px; text-align: right; }
.empty { padding: 10px 4px; color: var(--muted); }
.pager { padding-top: 8px; gap: 3px; }
.pager-info { margin-left: 8px; color: var(--muted); }
.swatch { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.swatch.big { width: 12px; height: 12px; }

/* Meetup page */
.meetup-main { align-items: flex-start; gap: 16px; margin-top: 12px; flex-wrap: nowrap; }
.poster {
  flex: 0 0 220px; height: 300px; padding: 14px; color: #fff; border-radius: var(--radius);
  display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
}
.poster-cat { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; opacity: .85; }
.poster-head { font-size: 24px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.poster-when { font-size: 12px; opacity: .9; }
.meta { gap: 16px; }
.description { white-space: pre-wrap; padding: 2px 0; min-height: 20px; }
.actions { border-top: 1px solid var(--line); padding-top: 8px; }

.map { height: 260px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--soft); }

/* Popups */
.overlay {
  position: fixed; inset: 0; z-index: 50; padding: 16px;
  display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .3);
}
.popup {
  width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; padding: 14px;
  background: var(--bg); border-radius: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}
.message { white-space: pre-line; padding: 2px 0 4px; }
.suggest { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; }
.profile .bar { margin: -14px -14px 6px; }
.avatar { width: 96px; height: 96px; object-fit: cover; border-radius: 50%; cursor: pointer; background: var(--soft); }
.fields { gap: 4px; }
.editable { cursor: pointer; border-bottom: 1px dashed var(--line-strong); }
.editable:hover { border-bottom-color: var(--accent); }
.editable.blank { color: var(--muted); font-style: italic; }

.cal-dow, .cal-none { display: none; }
.cal-grid.month .cal-row:not(.cal-head) .cal-cell { cursor: pointer; }
.cal-grid.month .cal-row:not(.cal-head) .cal-cell:hover { background: var(--soft); }

/* Touch devices: no hover previews, bigger tap targets, no iOS zoom on focus. */
@media (hover: none) {
  .preview { display: none !important; }
}
@media (pointer: coarse) {
  button { min-height: 34px; padding: 4px 12px; }
  input, select, textarea { font-size: 16px; min-height: 36px; }
  textarea { min-height: 0; }
  input[type=checkbox] { min-height: 0; width: 18px; height: 18px; }
}

/* Phones (keep in sync with isNarrow() in app.js). */
@media (max-width: 700px) {
  body { padding: 6px 12px; }
  .tagline { display: none; }
  .header .logo { font-size: 18px; }
  .pad { padding: 8px; }

  /* Calendar toolbar: title on its own line. */
  .calendar .toolbar { gap: 4px; }
  .cal-title { order: -1; flex: 1 1 100%; margin: 0 0 2px; font-size: 15px; }

  /* Month: compact grid with colored dots; tap a day to open its week. */
  .cal-grid.month .cal-row:not(.cal-head) .cal-cell { min-height: 48px; padding: 2px; }
  .cal-grid.month .ev {
    display: inline-block; width: 7px; height: 7px; margin: 0 2px 0 0; border-radius: 50%;
    background: currentColor; pointer-events: none;
  }
  .cal-grid.month .ev > * { display: none; }
  .cal-grid.month .ev.full { color: #bbb !important; }

  /* Week: stacked agenda, one day per line. */
  .cal-grid.week { border: 0; }
  .cal-grid.week .cal-head { display: none; }
  .cal-grid.week .cal-row { flex-direction: column; }
  .cal-grid.week .cal-row:not(.cal-head) .cal-cell {
    flex: none; min-height: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
    border: 0; border-bottom: 1px solid var(--line); padding: 6px 2px;
  }
  .cal-grid.week .cal-date { flex: 0 0 76px; font-size: 12px; }
  .cal-grid.week .cal-dow { display: inline; }
  .cal-grid.week .ev { flex: 1 1 calc(100% - 84px); margin: 0 0 0 84px; font-size: 13px; padding: 2px 0; }
  .cal-grid.week .cal-date + .ev { margin-left: 0; }
  .cal-grid.week .ev-time { display: inline; }
  .cal-grid.week .cal-none { display: block; flex: 1; color: #b0b0b0; font-size: 12px; }

  /* List: headline on top, details underneath. */
  .list-head { display: none; }
  .list-row { flex-wrap: wrap; padding: 7px 0; row-gap: 1px; }
  .list-row > * { padding: 0; color: var(--muted); font-size: 12px; }
  .list-row .c-head { order: -1; flex: 1 1 100%; color: var(--accent); font-size: 14px; white-space: normal; }
  .list-row .c-date, .list-row .c-time, .list-row .c-cat, .list-row .c-loc, .list-row .c-going { flex: 0 1 auto; }
  .list-row > :not(.c-head):not(:last-child)::after { content: "·"; margin: 0 5px; color: #c0c0c0; }
  .list-row .c-loc { min-width: 0; max-width: 100%; }
  .list-row .c-going { text-align: left; }
  .list-row.full .c-head { color: #aaa; }
  .pager { justify-content: center; }
  .pager-info { flex: 1 1 100%; text-align: center; margin: 2px 0 0; }

  /* Meetup page: poster becomes a banner. */
  .meetup-main { flex-wrap: wrap; gap: 12px; }
  .poster { flex: 1 1 100%; height: auto; min-height: 0; padding: 10px 12px; flex-direction: row; flex-wrap: wrap; gap: 4px 12px; }
  .poster-head { display: none; } /* the page heading sits right below */
  .poster-when { margin-left: auto; }
  .meta { gap: 4px 14px; }
  .actions { gap: 8px; }
  .actions button { flex: 1 1 0; }
  .actions label.inline { flex: 1 1 100%; order: 1; }
  .actions [data-f="where"], .actions [data-f="when"] { flex: 1 1 100%; }
  .map { height: 220px; }

  /* Popups: sheet anchored to the bottom, easy to reach with a thumb. */
  .overlay { align-items: flex-end; padding: 0; }
  .popup { max-width: none; max-height: 88vh; border-radius: 10px 10px 0 0; padding: 14px 12px calc(14px + env(safe-area-inset-bottom)); }
  .profile .bar { margin: -14px -12px 6px; border-radius: 10px 10px 0 0; }
  .buttons button { flex: 1 1 0; }
  .avatar { width: 72px; height: 72px; }
}
