/* Palette sampled from assets/emblem.png: navy #192f79, red #aa0e22, blue #3166b5, white. */
:root {
  --navy: #192f79;
  --navy-deep: #0e1b4a;
  --red: #aa0e22;
  --red-hot: #c2172f;
  --red-ink: #ff9aa6;
  --blue: #3166b5;
  --blue-ink: #8fb4ec;
  --ink: #ffffff;
  --ink-2: rgba(255, 255, 255, 0.74);
  --ink-3: rgba(255, 255, 255, 0.5);
  --line: rgba(255, 255, 255, 0.1);
  --line-2: rgba(255, 255, 255, 0.2);
  --panel: rgba(255, 255, 255, 0.05);
  --radius: 14px;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --sans: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--navy-deep);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
body.is-signin { background: var(--navy); }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--blue-ink); }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1, h2 { font-family: var(--serif); font-weight: 500; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--blue-ink); outline-offset: 2px; }
.spacer { flex: 1; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .two { grid-template-columns: 1fr; } }

label { display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); }
input, textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 15px;
  outline: none;
}
input:focus, textarea:focus { border-color: var(--blue-ink); box-shadow: 0 0 0 3px rgba(143, 180, 236, 0.22); }
textarea { resize: vertical; }
kbd { font: inherit; font-size: 12px; border: 1px solid var(--line-2); border-radius: 5px; padding: 0 5px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 13px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: rgba(255, 255, 255, 0.07); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--red-hot); }
.btn.ghost { border-color: transparent; color: var(--ink-2); }
.btn.big { padding: 13px 16px; justify-content: center; font-size: 15px; }

.icon-btn {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 18px;
  cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--ink); }

.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.avatar {
  flex: none;
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  color: #fff;
}
.avatar.xs { width: 20px; height: 20px; border-radius: 6px; font-size: 9px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; border-radius: 14px; font-size: 18px; }
.avatar.xl { width: 88px; height: 88px; border-radius: 22px; font-size: 30px; }
.tone-red { background: var(--red); }
.tone-blue { background: var(--blue); }
.tone-ink { background: #fff; color: var(--navy); }
.avatar { position: relative; overflow: visible; }
.presence-dot { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border: 2px solid var(--navy-deep); border-radius: 50%; background: #69738c; }
.avatar[data-presence="online"] .presence-dot { background: #52dc94; }
.avatar.xs .presence-dot { width: 9px; height: 9px; }
.live-active { white-space: nowrap; }
.member-summary { white-space: nowrap; gap: 6px; }

.role {
  font-size: 11px;
  color: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 0 6px;
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 50;
  background: var(--red); color: #fff;
  padding: 10px 14px; border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

/* Sign-in: the emblem's navy is the page navy, so the square image has no visible edge. */
.signin {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 420px);
  align-items: center;
  gap: clamp(24px, 5vw, 80px);
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px clamp(24px, 6vw, 96px);
}
.signin-art img { display: block; width: min(100%, 600px); height: auto; margin-left: auto; }
.signin-panel h1 { font-size: clamp(40px, 4.4vw, 56px); line-height: 1; margin-bottom: 16px; letter-spacing: -0.01em; }
.lede { color: var(--ink-2); max-width: 40ch; margin-bottom: 28px; }
.error {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(170, 14, 34, 0.28);
  border: 1px solid rgba(170, 14, 34, 0.7);
  color: #ffd5da;
  font-size: 14px;
}
.fine { color: var(--ink-3); font-size: 13px; margin-top: 24px; }
@media (max-width: 820px) {
  .signin { grid-template-columns: 1fr; }
  .signin-art img { margin: 0 auto; width: min(70vw, 360px); }
}

/* App shell */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); height: 100vh; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.page { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.scroll { flex: 1; overflow: auto; min-height: 0; padding: 24px 0; }
.column { width: min(760px, calc(100% - 48px)); margin: 0 auto; }
.column.wide { width: min(1040px, calc(100% - 48px)); }
.column.narrow { width: min(640px, calc(100% - 48px)); }

.topbar {
  flex: none;
  display: flex; align-items: center; gap: 12px;
  min-height: 52px;
  padding: 8px 22px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 10px; }
.search input { border: 0; background: transparent; padding: 7px 0; box-shadow: none; width: 220px; }

.sidebar {
  background: var(--navy);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 14px 10px;
  min-height: 0; overflow: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; color: var(--ink); text-decoration: none; }
.brand img { width: 56px; height: 56px; display: block; }
.brand b { display: block; font-family: var(--serif); font-size: 16px; font-weight: 500; line-height: 1.15; }
.brand small { display: block; font-size: 12px; color: var(--ink-3); }
.nav { display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: var(--ink); }
.nav-item.on { background: rgba(49, 102, 181, 0.5); color: #fff; }
.side-label { font-size: 12px; color: var(--ink-3); padding: 18px 10px 6px; }
.side-note { font-size: 13px; color: var(--ink-3); padding: 4px 10px; }
.me {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 6px 4px;
  border-top: 1px solid var(--line);
}
.me-name { flex: 1; min-width: 0; display: grid; color: var(--ink); text-decoration: none; }
.me-name small { color: var(--ink-3); font-size: 12px; }

/* Stream */
.stream { flex: 1; overflow: auto; min-height: 0; padding: 8px 0 16px; }
.day { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 12px; margin: 22px 0 6px; }
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.empty { color: var(--ink-3); text-align: center; padding: 48px 0; }
.item { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 10px 0; }
.item-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.item-head time { color: var(--ink-3); font-size: 12px; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--blue-ink); }
.text { margin-top: 3px; overflow-wrap: anywhere; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 8px;
}
.card h3 { font-size: 17px; margin: 4px 0 6px; }
.kicker { font-size: 12px; font-weight: 600; color: var(--blue-ink); }
.meta { display: flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: 13px; margin-top: 4px; }
.meta .ic { color: var(--ink-3); }
.detail { margin-top: 8px; color: var(--ink-2); font-size: 14px; }
.announce { border-left: 3px solid var(--red); }
.announce .kicker { color: var(--red-ink); }
.announce p { margin-top: 4px; color: var(--ink-2); }

.rsvp { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.seg {
  display: inline-flex; gap: 6px; align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
}
.seg:hover { color: var(--ink); }
.seg.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.seg span { opacity: 0.7; }

.poll-opt {
  position: relative; overflow: hidden;
  display: flex; justify-content: space-between; gap: 12px;
  width: 100%;
  margin-top: 6px;
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.poll-opt:hover { border-color: var(--ink-3); }
.poll-opt.on { border-color: var(--blue-ink); }
.poll-opt .bar { position: absolute; inset: 0 auto 0 0; background: rgba(49, 102, 181, 0.55); }
.poll-opt .lbl, .poll-opt .pct { position: relative; }
.poll-opt .pct { color: var(--ink-3); font-size: 13px; white-space: nowrap; }

.photos { display: grid; gap: 6px; margin-top: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.photos.n1 { grid-template-columns: minmax(0, 420px); }
.photos.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.photos img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.media { margin: 10px 0 0; max-width: 560px; }
.media video { display: block; width: 100%; border-radius: 10px; background: #000; }
.media figcaption { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.embed { position: relative; aspect-ratio: 16 / 9; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 10px; }
.file {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
}
.file small { display: block; color: var(--ink-3); font-size: 12px; }

/* Composer */
.composer-wrap { position: relative; flex: none; width: min(760px, calc(100% - 48px)); margin: 0 auto 20px; }
.composer {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  padding: 10px 12px 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}
.composer textarea {
  display: block;
  border: 0; background: transparent; box-shadow: none;
  padding: 6px 4px; min-height: 44px; max-height: 200px;
  resize: none;
}
.composer textarea::placeholder { color: var(--ink-3); }
.composer-bar { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.hint { font-size: 12px; color: var(--ink-3); }
.send {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 0; border-radius: 10px;
  background: var(--red); color: #fff;
  cursor: pointer;
}
.send:hover { background: var(--red-hot); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 2px 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 4px 3px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
  font-size: 13px;
}
.chip button { display: grid; place-items: center; border: 0; background: transparent; color: var(--ink-2); padding: 2px; cursor: pointer; border-radius: 5px; }
.chip button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.1); }
.chip.private { background: rgba(49, 102, 181, 0.45); }
.menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px);
  max-height: 280px; overflow: auto;
  padding: 6px;
  background: var(--navy);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}
.menu button {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0; border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.menu button:hover { background: rgba(255, 255, 255, 0.08); }
.menu button small { margin-left: auto; color: var(--ink-3); font-size: 12px; }

.builder { display: grid; gap: 10px; margin: 0 0 10px; background: var(--navy); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35); }
.builder-head { display: flex; align-items: center; justify-content: space-between; }

/* Plan */
.plan {
  flex: 1; min-height: 0; overflow: auto;
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 28px;
  width: min(1180px, calc(100% - 48px)); margin: 0 auto;
  padding: 24px 0;
}
@media (max-width: 980px) { .plan { grid-template-columns: 1fr; } }
.cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.cal-head h2 { flex: 1; font-size: 22px; }
.section-title { font-size: 20px; margin-bottom: 12px; }
.cal {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.dow { background: var(--navy); font-size: 11px; color: var(--ink-3); padding: 6px 8px; }
.cell { background: var(--navy-deep); min-height: 96px; padding: 6px; color: var(--ink-2); font-size: 12px; min-width: 0; }
.cell.out { opacity: 0.4; }
.cell .num { display: inline-block; min-width: 20px; margin-bottom: 4px; }
.cell.today .num { background: var(--red); color: #fff; border-radius: 6px; padding: 0 5px; }
.ev {
  display: block; margin-top: 3px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(49, 102, 181, 0.6);
  color: #fff;
  font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ev.event { background: var(--red); }
.more { display: block; margin-top: 3px; color: var(--ink-3); font-size: 11px; }

/* Members and profile */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.member-card {
  display: grid; gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
}
.member-card:hover { border-color: var(--line-2); }
.member-card b { display: block; }
.member-card .role { margin-top: 4px; display: inline-block; }
.profile-head { display: flex; align-items: center; gap: 18px; }
.profile-head h1 { font-size: 34px; line-height: 1.1; }
.profile-head p { margin-top: 4px; }
.bio { color: var(--ink-2); font-size: 16px; max-width: 56ch; }
.card.stack h3 { font-size: 17px; }

/* Phone and iPad shell (<= 1024px). The desktop rules above still apply wider than that. */
.m-tabbar,
.m-sheet { display: none; }

@media (max-width: 1024px), (max-width: 1366px) and (pointer: coarse) {
  body { font-size: 16px; }
  input, textarea { font-size: 16px; } /* Stops iOS zooming into fields. */
  .app {
    display: flex; flex-direction: column;
    height: 100vh; height: var(--app-height, 100dvh);
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  }
  .sidebar { display: none; }
  .main { flex: 1; min-width: 0; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }

  .m-tabbar {
    flex: none;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    background: var(--navy);
    border-top: 1px solid var(--line-2);
    padding: 4px max(8px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }
  .m-tab {
    position: relative;
    display: grid; justify-items: center; align-content: center; gap: 3px;
    min-height: 56px;
    padding: 4px 2px;
    border: 0; border-radius: 10px;
    background: transparent;
    color: var(--ink-2);
    font-size: 13px; font-weight: 600; line-height: 1.1;
    text-decoration: none;
    cursor: pointer;
  }
  .m-tab:hover { color: var(--ink); }
  .m-tab.on { color: #fff; }
  .m-tab.on::before {
    content: ""; position: absolute; top: 0; left: 28%; right: 28%;
    height: 3px; border-radius: 0 0 3px 3px;
    background: var(--red);
  }
  .m-ic {
    width: 22px; height: 22px; flex: none;
    fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  }
  .app:has(textarea:focus) .m-tabbar,
  .app:has(input:focus) .m-tabbar { display: none; }

  .m-sheet { display: block; position: fixed; inset: 0; z-index: 40; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: var(--ink); }
  .m-sheet::backdrop { background: transparent; }
  .m-scrim { position: absolute; inset: 0; border: 0; background: rgba(8, 14, 40, 0.6); cursor: pointer; }
  .m-sheet-panel {
    position: absolute; left: 0; right: 0; bottom: 0;
    display: flex; flex-direction: column;
    max-height: 72vh; max-height: 72dvh;
    background: var(--navy);
    border-top: 1px solid var(--line-2);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.35);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .m-sheet-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 10px 4px 18px;
    font-family: var(--serif); font-size: 19px;
  }
  .m-sheet-head b { font-weight: 500; }
  .m-sheet-head .icon-btn { width: 44px; height: 44px; }
  .m-sheet-body { overflow: auto; overscroll-behavior: contain; padding: 4px 10px 14px; }
  .m-sheet-body .nav-item { min-height: 44px; padding: 10px 12px; font-size: 16px; }
  .m-sheet-body .side-label { padding-top: 10px; font-size: 13px; }
  .m-sheet-body .me { margin-top: 10px; padding: 12px 6px 0; }
  .m-sheet-body .me .icon-btn { width: 44px; height: 44px; }
}

@media (max-width: 600px) {
  .signin { padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }

  .column, .column.wide, .column.narrow { width: calc(100% - 32px); }
  .scroll { padding: 16px 0; }
  .stream { padding: 4px 0 12px; }

  .topbar { padding: 10px 14px; row-gap: 6px; }
  .topbar > .muted { order: 2; flex: 1 1 100%; font-size: 13px; }
  .member-summary { padding: 6px 0; font-size: 13px; }
  .member-summary .live-active { font-size: 12px; }
  .topbar .spacer { display: none; }
  .topbar .search { order: 3; flex: 1 1 100%; }
  .search input { width: 100%; min-width: 0; padding: 11px 0; }
  .title { font-size: 17px; }

  .btn { min-height: 44px; padding: 10px 14px; font-size: 15px; }
  .btn.big { min-height: 48px; }
  .icon-btn { width: 44px; height: 44px; }
  .seg { min-height: 44px; padding: 10px 12px; font-size: 14px; }
  .poll-opt { min-height: 44px; padding: 11px 12px; }
  .menu button { min-height: 44px; padding: 11px 10px; }
  .chip { position: relative; }
  .chip button { position: relative; }
  .chip button::before { content: ""; position: absolute; inset: -12px; }

  .item { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; }
  .item-head { font-size: 15px; }
  .item-head time, .meta, .detail, .small { font-size: 14px; }
  .day, .tag { font-size: 13px; }
  .card { padding: 14px; }
  .card h3 { font-size: 18px; }
  .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photos.n1 { grid-template-columns: minmax(0, 1fr); }
  .media { max-width: 100%; }
  .file { max-width: 100%; }

  .composer-wrap { width: calc(100% - 24px); margin: 0 auto 8px; }
  .composer { padding: 8px 10px; border-radius: 16px; }
  .composer textarea { min-height: 44px; }
  .hint { display: none; }
  .send { width: 44px; height: 44px; }

  .plan { width: calc(100% - 32px); gap: 16px; padding: 16px 0; grid-template-columns: minmax(0, 1fr); }
  .plan > section:first-child { display: contents; }
  .plan .cal-head, .plan .cal { display: none; }
  .section-title { font-size: 22px; }

  .grid-cards { grid-template-columns: minmax(0, 1fr); }
  .member-card { grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 14px; row-gap: 6px; padding: 14px; }
  .member-card > .avatar { grid-row: 1 / span 2; }
  .member-card > div, .member-card > p { grid-column: 2; min-width: 0; }

  .profile-head { gap: 14px; }
  .profile-head h1 { font-size: 28px; }
  .bio { font-size: 16px; }
  .profile-head .avatar.xl { width: 72px; height: 72px; }
}
