:root {
  /* Surfaces */
  --canvas: #EEF2EB;
  --surface: #ffffff;
  --surface-sunken: #F4F7F2;
  --surface-faint: #FAFCF8;

  /* Text */
  --text: #1C2620;
  --text-muted: #6A766F;
  --text-subtle: #9AA69D;

  /* Brand green */
  --green: #178A5C;
  --green-dark: #0F6E48;
  --green-tint: #EAF6EE;
  --brand-gradient: linear-gradient(150deg, #4FC774, #19996E 58%, #137C66);

  /* Identity purple */
  --purple: #3A1378;
  --purple-mid: #6233B0;
  --purple-tint: #EFE9FB;
  --avatar-gradient: linear-gradient(140deg, #3A1378, #6233B0);

  /* Lime accent */
  --lime: #A6E646;
  --lime-tint: #DCF5B8;
  --lime-dark: #2C5212;

  /* Borders */
  --border: #E5EAE1;
  --border-strong: #E1E7DC;

  /* Typography */
  --font-display: 'Baloo 2', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;

  /* Layout */
  --nav-height: 64px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--canvas);
  font-family: var(--font-body);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--lime);
  color: #15433a;
}

input, textarea, button {
  font-family: var(--font-body);
}

#root {
  height: 100%;
}

/* ── Authenticated app shell ── */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100svh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--canvas);
  overflow: hidden;
}

.page-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

/* ── Bottom nav ── */
.bottom-nav {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 6px env(safe-area-inset-bottom, 18px);
  min-height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 5;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  width: 56px;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.nav-label {
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
}

/* ── Sidebar (desktop only) ── */
.sidebar {
  display: none;
  width: 185px;
  flex-shrink: 0;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 12px 16px;
  overflow-y: auto;
}

.sidebar-nav-item {
  display: block;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.sidebar-nav-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 11px;
  cursor: pointer;
}

.sidebar-nav-row--active {
  background: #EAF6EE;
}

.sidebar-nav-label {
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

/* ── Feed header wordmark (hidden at desktop) ── */
.feed-wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

/* ── Content wrap (centered at desktop) ── */
.content-wrap {
  min-height: 100%;
}

/* ── Desktop breakpoint ── */
@media (min-width: 768px) {
  .app-shell {
    flex-direction: row;
    max-width: none;
  }

  .bottom-nav {
    display: none;
  }

  .sidebar {
    display: flex;
  }

  .content-wrap {
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
  }

  .feed-wordmark {
    display: none;
  }

  .feed-header {
    justify-content: flex-end;
  }
}

/* ── Sidebar new post button ── */
.sidebar-new-post-btn {
  width: 100%;
  background: #178A5C;
  color: #fff;
  border: none;
  border-radius: 11px;
  padding: 12px 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  margin-top: 6px;
}

.sidebar-new-post-btn:hover {
  background: #0F6E48;
}

/* ── Sidebar profile row ── */
.sidebar-profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  width: 100%;
  cursor: pointer;
  text-align: left;
  color: var(--text);
}

.sidebar-profile-row:hover {
  background: var(--surface-sunken);
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 14px);
  left: 50%;
  transform: translateX(-50%);
  background: #1C2620;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border-radius: 20px;
  padding: 8px 20px;
  z-index: 200;
  pointer-events: none;
  white-space: nowrap;
  animation: toastIn 0.15s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
