/* Shared desktop, tablet and mobile navigation. Keep this after page styles. */
.app-shell { --navigation-width: 264px; }
.sidebar {
  --nav-text: #43523d;
  --nav-muted: #5f6b57;
  --nav-active: #e1e8d6;
  --nav-indicator: #596d40;
  padding: 24px 16px max(20px, env(safe-area-inset-bottom));
}
.sidebar .sidebar-heading { margin: 0 0 20px; gap: 8px; }
.sidebar .sidebar-heading .brand { margin: 0 10px; }
.sidebar .brand-logo { width: 174px; }
.sidebar .sidebar-create {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  margin-bottom: 24px;
  padding: 12px 16px;
  border: 1px solid #d4c55f;
  border-radius: 10px;
  background: #f1e480;
  color: #273020;
  font-size: 14px;
  font-weight: 650;
  box-shadow: none;
}
.sidebar .sidebar-create:hover { background: #f7ec9c; }
.sidebar .sidebar-create .icon { width: 21px; height: 21px; }
.sidebar .main-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  height: auto;
  overflow: visible;
}
.sidebar .nav-caption {
  display: block;
  margin: 0 0 7px;
  padding: 0 12px;
  color: var(--nav-muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 1.5px;
  line-height: 1.5;
}
.sidebar .nav-divider {
  display: block;
  height: 1px;
  margin: 14px 12px;
  background: var(--border);
}
.sidebar .main-nav .nav-item,
.sidebar .sidebar-bottom .nav-item {
  position: relative;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--nav-text);
  font-size: 14px;
  font-weight: 450;
  line-height: 1.4;
  text-align: left;
}
.sidebar .nav-item .icon { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar .main-nav .nav-item > span:not(.nav-count) { white-space: normal; }
.sidebar .nav-item:hover,
.sidebar .list-nav button:hover { background: var(--surface-hover, #e6eadd); color: var(--ink); }
.sidebar .nav-item.active {
  background: var(--nav-active);
  color: var(--ink);
  font-weight: 650;
}
.sidebar .nav-item.active::before {
  content: "";
  position: absolute;
  inset: 9px auto 9px 0;
  width: 3px;
  border-radius: 2px;
  background: var(--nav-indicator);
}
.sidebar .nav-count {
  position: static;
  flex-shrink: 0;
  margin-left: auto;
  min-width: 23px;
  width: auto;
  height: auto;
  padding: 2px 5px;
  border-radius: 5px;
  background: transparent;
  color: var(--nav-muted);
  font-size: 11px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.sidebar .nav-count[hidden] { display: none; }
.sidebar .nav-item.active .nav-count { background: var(--surface-hover, #d5dfc8); color: inherit; }
.sidebar .lists-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 16px 12px 4px;
  padding: 8px 0 0;
  border-top: 1px solid var(--border);
}
.sidebar .add-list-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: auto;
  height: auto;
  min-height: 44px;
  padding: 0 4px;
  border-radius: 6px;
  color: var(--nav-text);
  font-size: 12px;
  font-weight: 550;
  letter-spacing: normal;
  white-space: nowrap;
}
.sidebar .add-list-button .icon { width: 16px; height: 16px; }
.sidebar .add-list-button:hover { background: var(--surface-hover, #e6eadd); }
.sidebar .sidebar-list-row { grid-template-columns: minmax(0, 1fr) 44px; }
.sidebar .list-nav .list-select {
  gap: 10px;
  min-height: 44px;
  padding: 10px 4px 10px 12px;
  border-radius: 8px;
  color: var(--nav-text);
  font-size: 14px;
}
.sidebar .list-copy { display: flex; align-items: center; gap: 6px; }
.sidebar .list-name { flex: 1; min-width: 0; }
.sidebar .list-visibility,
.sidebar .list-visibility.is-shared {
  position: static;
  display: block;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  flex-shrink: 0;
  max-width: 64px;
  margin: 0;
  color: var(--nav-muted);
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: normal;
  white-space: normal;
}
.sidebar .list-nav .list-select.active { color: var(--ink); font-weight: 650; }
.sidebar .list-nav .list-more { width: 44px; height: 44px; color: var(--nav-muted); }
.sidebar .list-nav .list-actions button { min-height: 44px; font-size: 13px; }
.sidebar .sidebar-bottom { margin-top: auto; padding-top: 22px; }
.sidebar .sidebar-bottom::before {
  content: "";
  display: block;
  height: 1px;
  margin: 0 12px 12px;
  background: var(--border);
}
.sidebar .sidebar-bottom [data-action="sharing-inbox"] { font-size: 13px; gap: 9px; }
.sidebar #sharing-count { margin-left: auto; font-size: 11px; color: var(--nav-muted); }
.sidebar #sharing-count:empty { display: none; }
.sidebar .sidebar-bottom .account-button {
  min-height: 64px;
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
}
body[data-current-view="today"].is-guest .sidebar .account-button { display: flex; }
.sidebar .account-mark { display: grid; place-items: center; width: 32px; height: 32px; position: relative; overflow: hidden; }
.sidebar .account-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.sidebar #account-nav-status::before { background: var(--nav-muted); }
.sidebar #account-nav-status[data-sync-state="synced"]::before { background: #4b9a60; }
.sidebar #account-nav-status[data-sync-state="attention"]::before { background: #b77928; }
.sidebar .account-copy > span { font-weight: 600; font-size: 13px; }
.sidebar .account-copy small { margin-top: 2px; font-size: 11px; color: var(--nav-muted); }
.sidebar .account-chevron { width: 16px; height: 16px; color: var(--nav-muted); }
.sidebar .prototype-tag {
  justify-content: flex-start;
  margin: 12px 10px 0;
  padding: 0;
  border: 0;
  color: var(--nav-muted);
  font-size: 11px;
  line-height: 1.6;
  text-align: left;
  white-space: normal;
}
.sidebar :is(button, a):focus-visible { outline: 2px solid var(--focus, #536c3e); outline-offset: -2px; }
.sidebar .navigation-close { width: 44px; height: 44px; }
html[data-theme="dark"] .sidebar {
  --nav-text: #e3e8dc;
  --nav-muted: #bac5af;
  --nav-active: #35432c;
  --nav-indicator: #f1e480;
  background: #1b231c;
}
html[data-theme="dark"] .sidebar .account-mark { background: #35442d; color: #e3e8dc; }
@media (min-width: 1025px) {
  .sidebar { width: var(--navigation-width); }
  .main-shell { margin-left: var(--navigation-width); }
}
/* Keep this breakpoint in sync with navigation.js. The modal drawer gives
   tablets their full content width while retaining every destination. */
@media (max-width: 1024px) {
  body.navigation-open { overflow: hidden; }
  .main-shell { margin-left: 0; }
  .navigation-backdrop {
    position: fixed;
    inset: 0;
    z-index: 49;
    padding: 0;
    border: 0;
    background: #15201780;
    backdrop-filter: blur(2px);
    cursor: default;
  }
  body.navigation-open .navigation-backdrop { display: block; }
  .sidebar {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(320px, calc(100vw - 24px));
    height: 100vh;
    height: 100dvh;
    padding: 20px 16px max(20px, env(safe-area-inset-bottom));
    border: 0;
    border-right: 1px solid var(--border);
    border-radius: 0;
    background: var(--sidebar);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    backdrop-filter: none;
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform .18s ease, visibility .18s ease;
  }
  /* Reveal before navigation.js moves focus; animating visibility leaves the
     drawer unfocusable during the opening frame in real browsers. */
  body.navigation-open .sidebar { visibility: visible; transform: translateX(0); transition: transform .18s ease; box-shadow: 12px 0 45px #0003; }
  .navigation-toggle,
  .sidebar .navigation-close { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; }
  .sidebar .sidebar-heading { margin-bottom: 18px; }
  .sidebar .sidebar-heading .brand { margin-left: 10px; }
  body[data-current-view] .toast { left: 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}
