/* Logg app layer — everything here uses Botnest semantic tokens only. */

.lg-body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bn-bg);
}

/* Topbar */
.lg-topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding-top: env(safe-area-inset-top);
}
.lg-brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; text-decoration: none; color: var(--bn-chrome-text, var(--bn-text));
}
.lg-topdate { margin-left: auto; font-size: 13px; color: var(--bn-chrome-text-dim, var(--bn-text-3)); }
.lg-ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; }

/* Main + bottom tab bar */
.lg-main {
  flex: 1; width: 100%;
  max-width: 760px; margin: 0 auto;
  padding: 14px 14px calc(76px + env(safe-area-inset-bottom));
}
.lg-tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--bn-surface);
  border-top: 1px solid var(--bn-border);
  padding-bottom: env(safe-area-inset-bottom);
}
.lg-tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px 7px; font-size: 11px; text-decoration: none;
  color: var(--bn-text-3);
}
.lg-tab.is-active { color: var(--bn-action); }
.lg-tab:focus-visible { outline: 2px solid var(--bn-focus-ring); outline-offset: -2px; }

/* Chat */
.lg-chat { display: flex; flex-direction: column; gap: 10px; }
.lg-daychips { display: flex; flex-wrap: wrap; gap: 6px; }
.lg-msgs { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
.lg-msg {
  max-width: 88%;
  padding: 10px 13px; border-radius: 16px;
  font-size: 15px; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word;
}
.lg-msg--user {
  align-self: flex-end;
  background: var(--bn-action-subtle);
  border: 1px solid var(--bn-border-subtle);
  border-bottom-right-radius: 4px;
}
.lg-msg--ai {
  align-self: flex-start;
  background: var(--bn-surface);
  border: 1px solid var(--bn-border);
  border-bottom-left-radius: 4px;
  color: var(--bn-text);
}
.lg-msg--ai strong { color: var(--bn-text); }
.lg-composer {
  position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom));
  z-index: 25;
  background: var(--bn-bg);
  border-top: 1px solid var(--bn-border-subtle);
  padding: 8px 10px;
}
.lg-composer-inner {
  max-width: 760px; margin: 0 auto;
  display: flex; gap: 8px; align-items: flex-end;
}
.lg-composer textarea {
  flex: 1; resize: none; max-height: 132px; min-height: 40px;
}
.lg-main--chat { padding-bottom: calc(140px + env(safe-area-inset-bottom)); }
.lg-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.lg-typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--bn-text-3); animation: lg-blink 1.2s infinite both;
}
.lg-typing i:nth-child(2) { animation-delay: 0.15s; }
.lg-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes lg-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lg-typing i { animation: none; } }

/* Calendar page */
.lg-cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.lg-cal-title { font-weight: 700; font-size: 17px; text-transform: capitalize; }
.lg-cal-cell { position: relative; }
.lg-cal-cell .lg-dots { position: absolute; bottom: 4px; left: 0; right: 0; display: flex; gap: 3px; justify-content: center; }
.lg-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--bn-chart-1); }
.lg-dot--bal { background: var(--bn-chart-3); }
.lg-dot--neg { background: var(--bn-danger-fill); }
.lg-cal-weight { position: absolute; top: 3px; right: 5px; font-size: 9px; color: var(--bn-text-3); }

/* Day + dashboard cards */
.lg-stack { display: flex; flex-direction: column; gap: 14px; }
.lg-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lg-kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--bn-border-subtle); font-size: 14px; }
.lg-kv:last-child { border-bottom: 0; }
.lg-kv b { font-variant-numeric: tabular-nums; }
.lg-meal { padding: 7px 0; border-bottom: 1px solid var(--bn-border-subtle); font-size: 14px; }
.lg-meal:last-child { border-bottom: 0; }
.lg-meal .lg-mealtype { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--bn-text-3); }
.lg-chart-wrap { overflow-x: auto; }
.lg-chart-wrap svg { display: block; width: 100%; height: auto; }
.lg-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--bn-text-2); margin-top: 6px; }
.lg-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Campaign progress */
.lg-camp-days { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.lg-camp-day {
  width: 26px; height: 26px; border-radius: 6px;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 600;
  background: var(--bn-surface-2); color: var(--bn-text-3);
  border: 1px solid var(--bn-border-subtle);
  font-variant-numeric: tabular-nums;
}
.lg-camp-day.is-hit { background: var(--bn-success-subtle); color: var(--bn-success-text); border-color: var(--bn-success-border); }
.lg-camp-day.is-miss { background: var(--bn-danger-subtle); color: var(--bn-danger-text); border-color: var(--bn-danger-border); }
.lg-camp-day.is-today { outline: 2px solid var(--bn-focus-ring); }

/* Login */
.lg-login { min-height: 80dvh; display: grid; place-items: center; }

/* Small utilities */
.lg-muted { color: var(--bn-text-3); font-size: 13px; }
.lg-right { margin-left: auto; }
.lg-mt { margin-top: 10px; }
