:root {
  --teal: #0b7285;
  --teal-dark: #085a68;
  --teal-light: #e6f6f8;
  --ink: #14232b;
  --muted: #5c7079;
  --border: #dfe7ea;
  --bg: #f7fafb;
  --card: #ffffff;
  --danger: #c0392b;
  --radius: 10px;
  --maxw: 720px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.site-header .bar {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem 1rem;
}
.brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--teal-dark);
  letter-spacing: -.01em;
}
.brand .dot { color: var(--teal); }
.header-actions { display: flex; gap: .5rem; align-items: center; }
.header-actions a.btn-ghost { display: none; }
@media (min-width: 640px) {
  .header-actions a.btn-ghost { display: inline-block; }
}

/* Buttons */
.btn {
  display: inline-block;
  padding: .5rem .9rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .9rem;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--teal-dark); border-color: var(--border); }
.btn-ghost:hover { background: var(--teal-light); text-decoration: none; }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-block { display: block; width: 100%; text-align: center; }
button.btn { font-family: inherit; }

/* Main layout */
main.container {
  padding-top: 1rem;
  padding-bottom: 5rem; /* space for mobile bottom nav */
}
@media (min-width: 640px) {
  main.container { padding-bottom: 2rem; }
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

/* Forms */
label { display: block; font-weight: 600; font-size: .85rem; margin: .6rem 0 .25rem; }
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=number], input[type=date], select, textarea {
  width: 100%;
  padding: .55rem .6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; }
.helptext { color: var(--muted); font-size: .8rem; }
.errorlist { color: var(--danger); list-style: none; padding: 0; margin: .25rem 0; font-size: .85rem; }
form p { margin: 0 0 .4rem; }

/* Messages */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li {
  padding: .6rem .8rem;
  border-radius: 8px;
  margin-bottom: .5rem;
  font-size: .9rem;
  background: var(--teal-light);
  color: var(--teal-dark);
  border: 1px solid #bfe3e9;
}
.messages li.error { background: #fbe9e7; color: var(--danger); border-color: #f3c8c2; }

/* Post cards */
.post { }
.post-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  background: var(--teal-light); color: var(--teal-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: .75rem; }
.post-author { font-weight: 700; font-size: .9rem; }
.post-meta { color: var(--muted); font-size: .78rem; }
.post-body { white-space: pre-wrap; font-size: .95rem; }
.post-actions { display: flex; gap: 1rem; margin-top: .6rem; font-size: .85rem; color: var(--muted); }
.post-actions button { background: none; border: none; padding: 0; color: var(--muted); font: inherit; cursor: pointer; }
.post-actions button.liked, .post-actions .liked { color: var(--teal); font-weight: 700; }

.badge {
  display: inline-block;
  background: var(--teal-light);
  color: var(--teal-dark);
  border-radius: 999px;
  padding: .1rem .55rem;
  font-size: .72rem;
  font-weight: 700;
}

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mt-1 { margin-top: 1rem; }
.grid-stats { display: flex; gap: .75rem; margin: 1rem 0; }
.grid-stats .stat { flex: 1; text-align: center; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem .5rem; }
.grid-stats .stat strong { display: block; font-size: 1.2rem; color: var(--teal-dark); }

.hero { padding: 1.5rem 0 .5rem; }
.hero h1 { font-size: 1.6rem; }
.hero p { color: var(--muted); }

table.simple { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.simple th, table.simple td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--border); }

/* Bottom nav (mobile-first primary nav) */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 20;
}
.bottom-nav a {
  flex: 1;
  text-align: center;
  padding: .5rem 0 .6rem;
  font-size: .68rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
}
.bottom-nav a .icon { font-size: 1.2rem; line-height: 1; }
.bottom-nav a.active { color: var(--teal); font-weight: 700; }
@media (min-width: 640px) {
  .bottom-nav { display: none; }
}

.desktop-nav { display: none; }
@media (min-width: 640px) {
  .desktop-nav { display: flex; gap: 1rem; }
  .desktop-nav a { color: var(--muted); font-weight: 600; font-size: .9rem; }
  .desktop-nav a.active { color: var(--teal-dark); }
}

.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters select, .filters input[type=text] { width: auto; flex: 1; min-width: 120px; }
