/* HPA Community – colours follow the HPA navy/teal palette.
   Adjust the two brand tokens below to the exact template values. */
:root {
  --navy: #14284b;
  --teal: #0e8c8c;
  --teal-soft: #e3f3f2;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1a2233;
  --muted: #5d6779;
  --line: #dde2ea;
  --warn: #a4531b;
  --danger: #b3261e;
  --radius: 14px;
  --tab-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px);
  -webkit-text-size-adjust: 100%;
}
.hidden { display: none !important; }
a { color: var(--teal); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 6px; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--navy); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.logo { width: 30px; height: 30px; border-radius: 7px; }
.topbar-actions { display: flex; gap: 8px; }
.chip {
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .85rem; cursor: pointer; min-height: 36px;
}

.demo-banner { background: #fff4d6; color: #6b4e00; text-align: center; font-size: .85rem; padding: 6px 16px; }
.install-banner {
  display: flex; align-items: center; gap: 10px; background: var(--teal-soft);
  padding: 10px 16px; font-size: .9rem; border-bottom: 1px solid var(--line);
}
.install-banner span { flex: 1; }
.icon-btn { background: none; border: 0; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--muted); min-width: 36px; min-height: 36px; }

main { max-width: 720px; margin: 0 auto; padding: 16px; outline: none; }
section { margin-bottom: 20px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }

/* cards */
.card {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; color: inherit; text-decoration: none;
}
a.card:active { background: #f8fafc; }
.post.pinned { border-left: 4px solid var(--teal); }
.post-meta { font-size: .875rem; margin-bottom: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.link { font-size: .9rem; font-weight: 500; text-decoration: none; }
button.link { background: none; border: 0; padding: 0 0 12px; cursor: pointer; color: var(--teal); font: inherit; }

.event { display: flex; gap: 14px; }
.event-date {
  flex: 0 0 56px; height: 60px; border-radius: 10px; background: var(--navy); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.event-date span { font-size: 1.4rem; font-weight: 700; line-height: 1; }
.event-date small { text-transform: uppercase; font-size: .7rem; letter-spacing: .05em; }
.event-body { flex: 1; min-width: 0; }

.person { display: flex; gap: 12px; align-items: flex-start; }
.person-body { flex: 1; min-width: 0; }
.person-body p { margin-bottom: 2px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: 0 0 48px; }
.avatar-initials {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--teal-soft); color: var(--navy); font-weight: 700;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { font-size: .78rem; padding: 3px 9px; border-radius: 999px; background: #eef1f5; color: var(--text); }
.tag.accent { background: var(--teal-soft); color: #075e5e; }

.score { display: inline-flex; gap: 6px; align-items: baseline; margin-top: 6px; font-size: .85rem; color: var(--muted); }
.score b { color: var(--teal); font-size: 1.05rem; }
.reasons { margin: 6px 0 0; padding-left: 18px; font-size: .875rem; }
.reasons li.warn { color: var(--warn); }

.profile-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.profile-head .avatar { width: 64px; height: 64px; flex-basis: 64px; font-size: 1.3rem; }
dl { margin: 12px 0; }
dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: 10px; }
dd { margin: 4px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

/* forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--teal); color: #fff; border: 0; border-radius: 10px;
  padding: 12px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 44px;
}
.btn.secondary { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: .875rem; }
.btn:disabled { opacity: .6; }
.form label { display: block; font-size: .9rem; font-weight: 500; margin-bottom: 12px; }
input, select {
  display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 16px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); min-height: 44px;
}
input:focus, select:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid rgba(14,140,140,.35); outline-offset: 1px; }
.form .btn { width: 100%; }
.error { color: var(--danger); font-size: .9rem; }
.hint { color: var(--muted); font-size: .85rem; margin-top: 10px; }
.notice { background: #fff4d6; border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }

.filters { margin-bottom: 8px; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.filter-row select { margin-top: 0; font-size: 15px; }

.login { max-width: 420px; margin: 16px auto 0; text-align: center; }
.login .card { text-align: left; margin-top: 16px; }
.login-logo { width: 84px; height: 84px; border-radius: 18px; margin-bottom: 12px; }

/* bottom tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: .72rem;
}
.tabbar .ico { font-size: 1.25rem; line-height: 1; }
.tabbar a.active { color: var(--teal); font-weight: 600; }

/* loading dots */
.loading { display: flex; justify-content: center; gap: 6px; padding: 32px 0; }
.loading span { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); animation: pulse 1s infinite ease-in-out; }
.loading span:nth-child(2) { animation-delay: .15s; }
.loading span:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

@media (min-width: 720px) {
  .filter-row { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .loading span { animation: none; opacity: .7; }
}
