/* The sidebar is navy in BOTH themes. That is deliberate: the logo carries an
   opaque dark backdrop, so a dark rail lets it sit flush with no tile behind
   it. Theme tokens are re-pointed locally rather than overridden per rule, so
   every descendant below resolves against the dark surface for free. */
.leftbar {
  --bg-secondary: var(--color-ink-2);
  --bg-accent: var(--color-ink-3);
  --bg-primary: rgba(255, 255, 255, 0.04);
  --text-primary: #F2F2F0;
  --text-secondary: #A8A8A4;
  --text-accent: var(--color-yellow);
  --border: rgba(242, 242, 240, 0.10);
  --border-strong: rgba(242, 242, 240, 0.22);
  --brand-primary: var(--color-yellow);
  --shadow-color: rgba(0, 0, 0, 0.5);

  display: flex;
  flex-direction: column;
  width: 260px;
  height: 100vh;
  position: sticky;
  top: 0;
  padding: var(--space-md) var(--space-sm);
  gap: var(--space-md);
  background: var(--color-ink);
  border-right: 1px solid rgba(242, 242, 240, 0.08);
  font-family: var(--font-sans);
  color: var(--text-primary);
  box-sizing: border-box;
}

/* Brand */
.leftbar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0 var(--space-xs);
}

/* No background, no radius: the rail is already navy, so the logo's own
   backdrop blends into it and the mark reads as free-standing artwork. */
.leftbar__mark {
  display: block;
  flex: none;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.leftbar__wordmark {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

/* Navigation */
.leftbar__nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.leftbar__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.leftbar__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.925rem;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.leftbar__link:hover {
  background: var(--bg-accent);
  color: var(--text-primary);
}

.leftbar__link:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.leftbar__link.is-active {
  background: var(--bg-accent);
  color: var(--text-accent);
  font-weight: 600;
}

.leftbar__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.leftbar__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Footer */
.leftbar__footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.leftbar__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.5rem;
  padding: 0 0.75rem;
  font-size: 0.7rem;
}

.leftbar__legal a {
  color: var(--text-secondary);
  text-decoration: none;
  opacity: 0.75;
}

.leftbar__legal a:hover { opacity: 1; color: var(--text-accent); }

.leftbar__theme {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
}

.leftbar__theme:hover { background: var(--bg-accent); color: var(--text-primary); }
.leftbar__theme:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }
.leftbar__theme svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Profile */
.leftbar__profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.leftbar__profile:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 8px var(--shadow-color);
}

.leftbar__profile:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.leftbar__avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--color-yellow);
  color: var(--color-ink-2);
  font-size: 0.8rem;
  font-weight: 600;
}

.leftbar__identity {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.leftbar__name {
  font-size: 0.875rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leftbar__email {
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leftbar__chevron {
  width: 16px;
  height: 16px;
  margin-left: auto;
  flex-shrink: 0;
  color: var(--text-secondary);
}

@media (max-width: 900px) {
  .leftbar {
    width: 72px;
    padding: var(--space-md) 0.5rem;
  }

  .leftbar__wordmark,
  .leftbar__label,
  .leftbar__identity,
  .leftbar__chevron,
  .leftbar__legal {
    display: none;
  }

  .leftbar__link,
  .leftbar__profile,
  .leftbar__brand {
    justify-content: center;
  }
}
