/* Vin Club — members app
   Palette from the club's own material: deep green script logo on cream,
   Lora for all text and a typewriter face (Cousine) for dates, like the club's invitations. */

:root {
  --cream: #F5F1E6;
  --paper: #FFFDF8;
  --sage: #EEF3EB;
  --green: #093B24;
  --leaf: #3E6B4A;
  --ink: #15261C;
  --muted: #5F6B63;
  --line: #DAD9CC;
  --wine: #7A2E33;
  --focus: #2F7A52;

  /* Vin Club's own material: Lora for text, a typewriter face for dates */
  --font-ui: "Lora", Georgia, serif;
  --font-serif: "Lora", Georgia, serif;
  --font-mono: "Cousine", "Liberation Mono", "Courier New", monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --topbar: 56px;
  --maxw: 720px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.55 var(--font-ui);
  min-height: 100dvh;
}
img { display: block; max-width: 100%; }
a { color: var(--leaf); }
button { font: inherit; }
h1, h2, h3 { font-family: var(--font-serif); font-weight: 500; margin: 0; line-height: 1.2; letter-spacing: -0.005em; }
h1 { font-size: 28px; }
h2 { font-size: 21px; }
h3 { font-size: 18px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--cream);
  color: var(--green);
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(21,38,28,.03), 0 6px 14px -12px rgba(21,38,28,.25);
}
.topbar .brand {
  display: flex; align-items: center; justify-content: center;
  height: var(--topbar);
}
.topbar .brand img { height: 32px; width: auto; }
.tabs {
  display: flex; justify-content: flex-start; gap: 2px;
  padding: 0 8px 0;
  background: var(--cream);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 14px 12px;
  font-size: 15px; font-weight: 500;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs a.active { color: var(--green); border-bottom-color: var(--green); }
.tabs a .badge {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px;
  border-radius: 9px; background: var(--green); color: #fff;
  font-size: 12px; font-weight: 600; line-height: 18px; text-align: center;
}

/* ---------- Layout ---------- */
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 16px calc(40px + env(safe-area-inset-bottom));
}
.page-head { margin: 4px 0 18px; }
.page-head p { margin-top: 6px; }
.center { text-align: center; }
.stack > * + * { margin-top: 12px; }
.section { margin-top: 28px; }
.section h2 { margin-bottom: 10px; }
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.logo-lockup { margin: 28px auto 20px; width: 190px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--green);
  background: var(--green); color: #fff;
  font-weight: 500; font-size: 15px;
  cursor: pointer; text-decoration: none;
  transition: background .12s ease;
}
.btn:hover { background: #0C4A2E; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: transparent; color: var(--green); }
.btn.secondary:hover { background: var(--sage); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--leaf); padding: 0 8px; min-height: 36px; }
.btn.quiet:hover { background: var(--sage); }
.btn.danger { background: transparent; border-color: transparent; color: var(--wine); }
.btn.danger:hover { background: #F6ECEC; }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row.end { justify-content: flex-end; }
.btn-row.between { justify-content: space-between; align-items: center; }

:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.field .hint { display: block; font-size: 13px; color: var(--muted); margin-top: 5px; font-weight: 400; }
.input, textarea.input, select.input {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink);
  font: inherit;
}
textarea.input { min-height: 110px; resize: vertical; line-height: 1.45; }
.input:focus { border-color: var(--leaf); outline: none; box-shadow: 0 0 0 3px rgba(62,107,74,.18); }
.input.code { font-size: 26px; letter-spacing: .35em; text-align: center; font-weight: 500; }
.check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; font-size: 15px; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--green); flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 17px; background: var(--paper);
  font-size: 14px; cursor: pointer; user-select: none;
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip.on { background: var(--green); color: #fff; border-color: var(--green); }
.form-error { color: var(--wine); font-size: 14px; margin: 8px 0 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .two { grid-template-columns: 1fr; gap: 0; } }

.work-row { display: grid; grid-template-columns: 1.3fr 1fr .7fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
@media (max-width: 620px) {
  .work-row { grid-template-columns: 1fr 1fr auto; row-gap: 6px; margin-bottom: 14px; }
  .work-row .input:nth-child(1) { grid-column: 1 / 3; }
  .work-row .input:nth-child(4) { grid-column: 1 / 3; }
  .work-row .x { grid-column: 3; grid-row: 1; }
}
.phone-row { display: grid; grid-template-columns: 112px 1fr; gap: 8px; }
.phone-row select.cc { padding-left: 8px; padding-right: 8px; }
a.plain { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
a.plain:hover { text-decoration-color: var(--leaf); }
.chip.link { text-decoration: none; color: var(--green); }
.chip.link:hover { background: var(--sage); }
.sub.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.page-head .btn-row.between h1 { margin: 0; }
.work-row .x { border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; padding: 6px; cursor: pointer; }
.work-row .x:hover { color: var(--wine); }

/* ---------- Avatar ---------- */
.avatar {
  width: 56px; height: 56px; border-radius: 12px; flex: none;
  background: var(--sage); color: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-size: 20px; font-weight: 500;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 96px; height: 96px; border-radius: 18px; font-size: 34px; }
.avatar.xl { width: 128px; height: 128px; border-radius: 22px; font-size: 44px; }
.avatar-edit { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.avatar-edit input[type=file] { display: none; }

/* ---------- Members list ---------- */
.search {
  position: sticky; top: calc(var(--topbar) + 42px + env(safe-area-inset-top)); z-index: 10;
  background: var(--cream); padding: 4px 0 10px; margin: -4px 0 6px;
}
.search .input { background: var(--paper); }
.count { color: var(--muted); font-size: 14px; margin: 0 0 6px; }
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.list li { border-bottom: 1px solid var(--line); }
.row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 4px; text-decoration: none; color: inherit;
}
.row:hover { background: rgba(238,243,235,.6); }
.row .name { font-family: var(--font-serif); font-size: 17px; font-weight: 500; line-height: 1.25; }
.row .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.row .meta { margin-left: auto; color: var(--muted); font-size: 13px; text-align: right; flex: none; }
.row .you { font-size: 12px; color: var(--leaf); font-weight: 500; margin-left: 8px; }
.empty { padding: 36px 12px; text-align: center; color: var(--muted); }

/* ---------- Member detail ---------- */
.profile-head { display: flex; gap: 18px; align-items: center; margin-bottom: 20px; }
.profile-head h1 { font-size: 26px; }
.profile-head .sub { color: var(--muted); margin-top: 4px; }
.facts { margin: 0; padding: 0; list-style: none; }
.facts li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
.facts li span:last-child { color: var(--muted); text-align: right; white-space: nowrap; }
.bio { font-family: var(--font-serif); font-size: 17px; line-height: 1.55; white-space: pre-line; }
.contact { display: flex; flex-wrap: wrap; gap: 8px; }
.contact .btn { min-height: 40px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--leaf); text-decoration: none; font-size: 15px; margin-bottom: 14px; }

/* ---------- Admin ---------- */
.admin-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.admin-row .who { flex: 1 1 200px; min-width: 0; }
.admin-row .who .name { font-family: var(--font-serif); font-size: 16px; font-weight: 500; }
.admin-row .who .sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; background: var(--sage); color: var(--green); }
.pill.pending { background: #FFF3D6; color: #7A5A00; }
.pill.declined, .pill.left { background: #EFEAE6; color: var(--muted); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px;
  font-size: 14px; z-index: 50; max-width: calc(100% - 32px);
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
}

/* ---------- Loading ---------- */
.loading { padding: 48px 0; text-align: center; color: var(--muted); }
.spinner {
  width: 22px; height: 22px; margin: 0 auto 10px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--green);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .btn { transition: none; } }

.footer-note { margin-top: 36px; text-align: center; font-size: 13px; color: var(--muted); }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.lang-switch button { border: 0; background: var(--paper); padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--muted); }
.lang-switch button.on { background: var(--green); color: #fff; }

/* ---------- Vine ornaments (wide screens only) ---------- */
@media (min-width: 1100px) {
  body::before, body::after {
    content: ""; position: fixed; top: 40px; bottom: 0; width: 120px; z-index: 0; pointer-events: none;
    background: url("/img/vine.svg") repeat-y center top / 120px auto;
    opacity: .32;
  }
  body::before { left: calc(50% - var(--maxw) / 2 - 170px); }
  body::after  { right: calc(50% - var(--maxw) / 2 - 170px); transform: scaleX(-1); }
  /* content above the vines, header always above the content */
  .app { position: relative; z-index: 1; }
}

/* ---------- Photo albums ---------- */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.album-card { text-decoration: none; color: inherit; display: block; }
.album-cover {
  aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--sage);
  display: flex; align-items: center; justify-content: center; border: 1px solid var(--line);
}
.album-cover img { width: 100%; height: 100%; object-fit: cover; }
.album-empty { font-size: 32px; opacity: .5; }
.album-meta { padding: 8px 2px 0; }
.album-meta .name { font-family: var(--font-serif); font-size: 16px; font-weight: 500; line-height: 1.25; }
.album-meta .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; margin-top: 18px; }
.photo-tile { aspect-ratio: 1; border: 0; padding: 0; background: var(--sage); border-radius: 6px; overflow: hidden; cursor: pointer; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }

.viewer {
  position: fixed; inset: 0; z-index: 60; background: rgba(21,38,28,.96);
  display: flex; align-items: center; justify-content: center;
}
.viewer-img { max-width: 100vw; max-height: calc(100dvh - 90px); object-fit: contain; }
.viewer-x, .viewer-nav {
  position: absolute; border: 0; background: rgba(255,255,255,.12); color: #fff;
  width: 44px; height: 44px; border-radius: 22px; font-size: 26px; line-height: 1; cursor: pointer;
}
.viewer-x { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
.viewer-nav { top: 50%; transform: translateY(-50%); }
.viewer-nav.prev { left: 10px; } .viewer-nav.next { right: 10px; }
.viewer-bar {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #fff; font-size: 14px;
  background: linear-gradient(transparent, rgba(0,0,0,.45));
}
.viewer-cap { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.viewer-cap .muted { color: rgba(255,255,255,.7); }
.viewer .btn.danger { color: #F6B4B4; }
.viewer .btn.danger:hover { background: rgba(255,255,255,.1); }

/* ---------- Talks, events, board ---------- */
.dateblock {
  flex: none; width: 52px; height: 56px; border-radius: 10px; background: var(--sage); color: var(--green);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.dateblock .d { font-family: var(--font-serif); font-size: 22px; font-weight: 500; }
.dateblock .m { font-size: 11px; text-transform: lowercase; margin-top: 3px; color: var(--leaf); }
.event-row .name { font-size: 17px; }
.row .pill { flex: none; }
.pill.kind { background: #EEE9DC; color: #5A4A1F; }
.sub.small { font-size: 12px; margin-top: 4px; }
.sub.clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; color: var(--ink); font-size: 15px; }
.post-row { align-items: flex-start; }
.doc-row { cursor: default; }
.doc-row:hover { background: transparent; }
.doc-row .name { font-size: 16px; }
.doc-row .btn-row { flex: none; }
p.ok { color: var(--leaf); font-weight: 500; margin: 0; }
.section.first { margin-top: 10px; }
.section .btn-row.between h2 { margin: 0; }
.seeall { font-size: 14px; color: var(--leaf); text-decoration: none; }
.card.talk-hero { display: flex; gap: 16px; align-items: flex-start; text-decoration: none; color: inherit; margin-top: 10px; }
.card.talk-hero .name { font-family: var(--font-serif); font-size: 19px; font-weight: 500; line-height: 1.25; }
.card.talk-hero .sub { color: var(--muted); font-size: 14px; margin-top: 3px; }
.card.talk-hero:hover { border-color: var(--leaf); }
span.btn.sm { pointer-events: none; }

/* ---------- Comments ---------- */
.comments { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.comment { display: flex; gap: 12px; align-items: flex-start; }
.comment .avatar { width: 36px; height: 36px; border-radius: 9px; font-size: 14px; }
.comment-body { min-width: 0; flex: 1; }
.comment-meta { display: flex; gap: 10px; align-items: baseline; font-size: 13px; flex-wrap: wrap; }
.comment-text { white-space: pre-line; margin-top: 2px; font-size: 15px; line-height: 1.45; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; }
.comment-form textarea { min-height: 44px; flex: 1; }
.linkish { border: 0; background: none; color: var(--muted); font-size: 13px; cursor: pointer; padding: 0; text-decoration: underline; }
.linkish:hover { color: var(--wine); }

/* ---------- More menu ---------- */
.more-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.more-item { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.more-item:hover { background: rgba(238,243,235,.6); }
.more-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--sage); display: flex; align-items: center; justify-content: center; font-size: 20px; flex: none; }
.more-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.more-text .name { font-family: var(--font-serif); font-size: 17px; font-weight: 500; }
.more-text .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.more-item .chev { color: var(--muted); font-size: 22px; }
.badge.inline { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 8px; border-radius: 9px; background: var(--green); color: #fff; font-size: 12px; font-weight: 600; line-height: 18px; text-align: center; font-family: var(--font-ui); vertical-align: middle; }
input[type=file].input, input[type=file] { font-size: 14px; }
select.input { appearance: auto; }

/* ---------- Line icons ---------- */
.ico { display: inline-flex; align-items: center; justify-content: center; color: var(--green); line-height: 0; }
.more-icon { background: var(--sage); color: var(--green); }
.avatar.iconbox { color: var(--green); }
.avatar.iconbox .ico svg { width: 24px; height: 24px; }
.avatar.lg.iconbox .ico svg { width: 40px; height: 40px; }
.album-empty { opacity: .55; }
.album-empty .ico svg { width: 36px; height: 36px; }
a.with-ico { display: inline-flex; align-items: center; gap: 8px; }
a.with-ico .ico svg { width: 18px; height: 18px; }

/* tabs: centred when they fit, scrollable from the first tab when they don't */
.tabs a:first-child { margin-left: auto; }
.tabs a:last-child { margin-right: auto; }
@media (max-width: 480px) { .tabs a { padding: 8px 8px 12px; font-size: 14.5px; } .tabs a .badge { margin-left: 4px; } }

/* ---------- Calendar ---------- */
.cal { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 10px; }
.cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.cal-month { font-family: var(--font-serif); font-size: 19px; font-weight: 500; flex: 1; text-align: center; }
.cal-nav { border: 1px solid var(--line); background: var(--paper); color: var(--green); width: 36px; height: 36px; border-radius: 18px; font-size: 20px; line-height: 1; cursor: pointer; }
.cal-nav:hover { background: var(--sage); }
.cal-today { order: 4; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-wd { font-size: 11px; color: var(--muted); text-align: center; padding: 2px 0 6px; text-transform: lowercase; }
.cal-cell {
  min-height: 84px; border: 0; border-radius: 6px; background: transparent; padding: 4px 4px 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: stretch; gap: 3px; text-align: left; font: inherit; color: var(--ink); min-width: 0;
}
.cal-cell:hover { background: var(--sage); }
.cal-cell.out { color: #B9B8AC; }
.cal-num { font-size: 13px; line-height: 22px; width: 24px; height: 24px; text-align: center; border-radius: 12px; align-self: flex-start; }
.cal-cell.today .cal-num { background: var(--green); color: #fff; font-weight: 600; }
.cal-cell.sel { background: var(--sage); box-shadow: inset 0 0 0 1.5px var(--leaf); }
.cal-items { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-chip { font-size: 11px; line-height: 1.3; padding: 2px 5px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip.talk { background: var(--green); color: #fff; }
.cal-chip.event { background: #E3EBDD; color: var(--green); }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.cal-dots { display: none; gap: 3px; justify-content: center; margin-top: auto; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.talk { background: var(--green); }
.dot.event { background: transparent; box-shadow: inset 0 0 0 1.5px var(--leaf); }
.cal-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin: 10px 2px 2px; }
.cal-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.cal-daylist { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.cal-dayhead { font-size: 16px; margin-bottom: 4px; }
.cal-dayhead::first-letter, .cal-month::first-letter, .day-sep span::first-letter { text-transform: uppercase; }
.cal-hint { margin: 2px 0 0; }
/* compact (home) and phones: dots instead of titles */
.cal.compact .cal-cell, .cal.compact .cal-cell { min-height: 46px; align-items: center; }
.cal.compact .cal-num { align-self: center; }
.cal.compact .cal-items { display: none; }
.cal.compact .cal-dots { display: flex; }
@media (max-width: 620px) {
  .cal { padding: 10px 6px; }
  .cal-cell { min-height: 46px; align-items: center; padding: 3px 1px 5px; }
  .cal-num { align-self: center; }
  .cal-items { display: none; }
  .cal-dots { display: flex; }
}
.seg button { min-width: 84px; }

/* ---------- Home editor ---------- */
.home-editor { margin-bottom: 8px; }
.edit-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.edit-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.edit-list .check { margin: 0; padding: 8px 0; flex: 1; }
.edit-list .move { display: flex; gap: 2px; flex: none; }
.edit-list .move .btn { min-width: 36px; padding: 0 8px; font-size: 16px; }
.album-grid.small { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.album-grid.small .album-meta .name { font-size: 14px; }
.cal-chip.town { background: #F1E6C9; color: #5A4512; }
.dot.town { background: #C2A15A; }
.pill.kind.town { background: #F1E6C9; color: #5A4512; }

/* ---------- Typewriter details: dates, counts, statuses ---------- */
.dateblock .d, .dateblock .m,
.cal-month, .cal-wd, .cal-num, .cal-legend, .cal-more,
.pill, .badge, .badge.inline, .count, .seeall,
.comment-meta .muted, .sub.small, .viewer-cap .muted,
.album-meta .sub, .row .meta, .admin-row .sub:last-child {
  font-family: var(--font-mono);
  letter-spacing: 0;
}
.dateblock .d { font-size: 20px; font-weight: 700; }
.dateblock .m { font-size: 11px; text-transform: uppercase; letter-spacing: .02em; }
.cal-month { font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.cal-wd { font-size: 10.5px; text-transform: uppercase; }
.cal-num { font-size: 12.5px; }
.pill { font-size: 11.5px; font-weight: 700; }
.seeall { font-size: 13px; }
.tabs a { font-weight: 500; }
.btn { font-weight: 500; letter-spacing: .005em; }

/* ---------- Share row ---------- */
.share-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.share-row .btn { gap: 6px; }
.share-row .ico svg { width: 17px; height: 17px; }

/* ---------- Chat list ---------- */
.chat-row .name { display: flex; align-items: center; gap: 6px; }
.sub.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.chat-meta .time { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.badge.inline.dim { background: var(--line); color: var(--muted); }
.muted-ico { color: var(--muted); display: inline-flex; }
.muted-ico .ico { color: var(--muted); }
.muted-ico svg { width: 15px; height: 15px; }
.card.notice { margin: 0 0 14px; background: var(--sage); border-color: #D5E1CF; }
.notice-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.card.notice p { margin: 0 0 10px; }
ol.steps { margin: 0 0 4px; padding-left: 20px; }
ol.steps li { margin-bottom: 3px; }
.small-print { margin-top: 22px; }
.avatar.iconbox.sm { width: 36px; height: 36px; border-radius: 9px; }
.avatar.iconbox.sm .ico svg { width: 20px; height: 20px; }

/* ---------- Conversation ---------- */
body.chat-mode .app { padding-bottom: 0; max-width: 820px; }
body.chat-mode::before, body.chat-mode::after { display: none; }
.chat-page { display: flex; flex-direction: column; height: calc(100dvh - var(--topbar) - 42px - env(safe-area-inset-top) - 20px); min-height: 360px; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 0 0 10px; border-bottom: 1px solid var(--line); }
.chat-head .back { margin: 0; font-size: 20px; padding: 4px 6px 4px 0; text-decoration: none; }
.chat-title { min-width: 0; flex: 1; }
.chat-title .name { font-family: var(--font-serif); font-size: 18px; font-weight: 500; line-height: 1.2; }
.chat-title .sub { color: var(--muted); font-size: 13px; }
.chat-mute { gap: 4px; }
.chat-mute .ico svg { width: 18px; height: 18px; }
@media (max-width: 480px) { .chat-mute span:not(.ico) { display: none; } }
.chat-scroll { flex: 1; overflow-y: auto; padding: 10px 2px 12px; overscroll-behavior: contain; }
.chat-more { display: block; margin: 0 auto 8px; }
.chat-msgs { display: flex; flex-direction: column; gap: 2px; }
.day-sep { text-align: center; margin: 14px 0 8px; }
.day-sep span { font-family: var(--font-mono); font-size: 11px; color: var(--muted); background: var(--cream); padding: 2px 10px; border-radius: 10px; border: 1px solid var(--line); display: inline-block; }
.msg { display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; max-width: 100%; }
.msg.cont { margin-top: 2px; }
.msg.mine { justify-content: flex-end; }
.msg-av { width: 32px; flex: none; }
.msg-av .avatar { width: 32px; height: 32px; border-radius: 16px; font-size: 13px; }
.msg-col { display: flex; flex-direction: column; max-width: min(78%, 520px); min-width: 0; }
.msg.mine .msg-col { align-items: flex-end; }
.bubble {
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px 16px 16px 6px;
  padding: 7px 11px 6px; position: relative; min-width: 0; cursor: default;
}
.msg.cont .bubble { border-top-left-radius: 6px; }
.bubble.mine { background: var(--green); border-color: var(--green); color: #fff; border-radius: 16px 16px 6px 16px; }
.msg.mine.cont .bubble { border-top-right-radius: 6px; }
.bubble-name { font-size: 12.5px; font-weight: 600; color: var(--leaf); margin-bottom: 1px; }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15.5px; line-height: 1.4; }
.bubble-text a { color: inherit; text-decoration: underline; }
.bubble-time { display: block; text-align: right; font-family: var(--font-mono); font-size: 10.5px; opacity: .6; margin-top: 2px; }
.bubble-img { display: block; border: 0; padding: 0; margin: 2px 0 4px; background: none; cursor: zoom-in; }
.bubble-img img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; }
.bubble-actions { font-size: 12px; margin-top: 2px; }
.chat-composer { border-top: 1px solid var(--line); padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); background: var(--cream); }
.chat-composer.readonly { text-align: center; }
.chat-composer-row { display: flex; align-items: flex-end; gap: 8px; }
textarea.input.chat-input { min-height: 44px; height: 44px; max-height: 140px; resize: none; line-height: 1.4; padding: 11px 14px; border-radius: 22px; }
.chat-send, .chat-photo {
  flex: none; width: 44px; height: 44px; border-radius: 22px; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.chat-send { background: var(--green); }
.chat-send .ico { color: #fff; }
.chat-send:disabled { opacity: .5; }
.chat-photo { background: var(--sage); }
.chat-preview { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.chat-preview img { height: 64px; border-radius: 8px; }

/* ---------- Manual (More → Manual) ---------- */
.m-hero { background: var(--green); color: var(--cream); border-radius: var(--radius); padding: 34px 20px 28px; text-align: center; position: relative; margin: 4px 0 18px; }
.m-hero::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(245,241,230,.3); border-radius: 6px; pointer-events: none; }
.m-hero img { width: min(240px, 70%); margin: 0 auto; }
.m-rule { width: 44px; height: 1px; background: rgba(245,241,230,.6); margin: 18px auto 14px; }
.m-kicker { font: 700 13px/1 var(--font-mono); letter-spacing: .3em; text-transform: uppercase; }
.m-sub { font-style: italic; opacity: .85; margin-top: 10px; font-size: 15px; }
.m-lang { margin: -6px 0 14px; }
.m-toc { margin-bottom: 26px; }
.m-toc-head { font: 700 12px/1 var(--font-mono); letter-spacing: .22em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.m-toc-cols { display: grid; gap: 4px 28px; }
@media (min-width: 640px) { .m-toc-cols:has(> div + div) { grid-template-columns: 1fr 1fr; } }
.m-toc-part { font-family: var(--font-serif); font-weight: 600; margin: 8px 0 2px; }
.m-toc-list { list-style: none; margin: 0; padding: 0; }
.m-toc-list li { border-bottom: 1px solid var(--line); }
.m-toc-list li:last-child { border-bottom: 0; }
.m-toc-list a { display: block; padding: 8px 0; text-decoration: none; color: var(--green); }
.m-toc-list a:hover { color: var(--leaf); text-decoration: underline; }
.m-part-label { font: 700 12px/1 var(--font-mono); letter-spacing: .22em; text-transform: uppercase; color: var(--leaf); margin: 10px 0 4px; }
.m-admin { margin-top: 40px; padding-top: 22px; border-top: 2px solid var(--green); }
.m-section { padding: 18px 0 8px; border-bottom: 1px solid var(--line); scroll-margin-top: calc(var(--topbar) + 70px + env(safe-area-inset-top)); }
.m-section:last-child { border-bottom: 0; }
.m-section h2 { margin-bottom: 12px; }
.m-section p { line-height: 1.6; }
.m-steps, .m-list { margin: 0 0 14px; padding-left: 0; list-style: none; }
.m-steps { counter-reset: step; }
.m-steps li { counter-increment: step; position: relative; padding: 4px 0 8px 40px; line-height: 1.55; }
.m-steps li::before { content: counter(step); position: absolute; left: 0; top: 2px; width: 26px; height: 26px; border-radius: 50%; background: var(--sage); color: var(--green); font: 700 13px/26px var(--font-mono); text-align: center; }
.m-list li { position: relative; padding: 3px 0 6px 22px; line-height: 1.55; }
.m-list li::before { content: ""; position: absolute; left: 6px; top: 13px; width: 6px; height: 6px; border-radius: 50%; background: var(--leaf); }
.m-table-wrap { overflow-x: auto; margin: 4px 0 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); }
.m-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.m-table th { text-align: left; font: 700 11px/1.3 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); background: var(--sage); padding: 10px 12px; }
.m-table td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; line-height: 1.5; }
.m-table td:first-child { min-width: 110px; }
.m-note { background: var(--sage); border-left: 3px solid var(--leaf); border-radius: var(--radius-sm); padding: 12px 14px; margin: 4px 0 16px; line-height: 1.55; }
.m-figure { margin: 6px 0 18px; }
.m-figure img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }
.m-figure figcaption { font-size: 13px; color: var(--muted); font-style: italic; margin-top: 6px; text-align: center; }
.m-top { text-align: center; margin: 26px 0 10px; }
.m-top a { text-decoration: none; font-family: var(--font-mono); font-size: 13px; }
.btn.danger-text { color: var(--wine); }
.admin-row .who .ref { margin: 4px 0 2px; font-size: 14px; color: var(--green); font-weight: 600; }
