/**
 * SnS aside nav — styles (Session 44 page split).
 *
 * Tokens reference the dashboard's :root variables (oklch palette, --card,
 * --border, --muted-foreground, etc.). The aside lives outside the page-specific
 * card layouts so it doesn't inherit any section padding.
 *
 * Desktop (>=880px): fixed 220px column on the left, dashboard content gets
 * the right side. Mobile (<880px): aside collapses to a top accordion that
 * the hamburger toggle expands.
 */

/* Pages that use the new 220px aside override the dashboard's default 64px
   grid track. index.html (everything-page) keeps its 64px legacy track until
   it's rebuilt as pnl.html in step 7 of the page split. The `display: grid`
   declaration is repeated here for the calculator case — its baseline `.app`
   rule uses `display: block` (centred container), which would otherwise
   ignore grid-template-columns. */
/* TAT-055 (28 Apr 2026) — added "procurement" to the override list so the
   Log a buy page no longer sits behind the 220px aside. Also removed the
   calculator-centering `.main { max-width: 920px; margin: 0 auto }` rule —
   calculator now matches pnl/supply/sales full-width alignment per Kenneth. */
body[data-page="pnl"]         .app.show,
body[data-page="supply"]      .app.show,
body[data-page="sales"]       .app.show,
body[data-page="calculator"]  .app.show,
body[data-page="procurement"] .app.show {
  display: grid;
  grid-template-columns: 220px 1fr;
  max-width: none;
  margin: 0;
  padding: 0;
}

@media (max-width: 879px) {
  body[data-page="pnl"]         .app.show,
  body[data-page="supply"]      .app.show,
  body[data-page="sales"]       .app.show,
  body[data-page="calculator"]  .app.show,
  body[data-page="procurement"] .app.show {
    grid-template-columns: 1fr;
  }
}

aside.aside {
  --aside-w: 220px;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 18px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: var(--aside-w);
  min-height: 100vh;
  font: inherit;
  color: var(--card-foreground);
  z-index: 30;
}

aside.aside .aside-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px 12px;
  border-bottom: 1px solid var(--border);
}
aside.aside .aside-brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}
aside.aside .aside-brand-sub {
  font-size: 0.72rem;
  color: var(--muted-foreground);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Hamburger — hidden on desktop, shown on mobile. */
aside.aside .aside-toggle {
  display: none;
  position: absolute;
  top: 14px;
  right: 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 38px;
  height: 32px;
  padding: 0;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
}
aside.aside .aside-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--foreground);
  border-radius: 2px;
}

aside.aside .aside-nav {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
aside.aside .aside-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
aside.aside .aside-section-label {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  padding: 2px 8px 4px;
}
aside.aside .aside-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

aside.aside .aside-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--foreground);
  font-size: 0.92rem;
  transition: background 120ms ease, color 120ms ease;
  border: 1px solid transparent;
}
aside.aside .aside-link:hover { background: var(--muted); }
aside.aside .aside-link.active {
  background: color-mix(in oklch, var(--primary) 22%, var(--card));
  border-color: color-mix(in oklch, var(--primary) 45%, transparent);
  color: var(--foreground);
}
aside.aside .aside-link-label { font-weight: 500; }
aside.aside .aside-link-hint  {
  font-size: 0.72rem;
  color: var(--muted-foreground);
}
aside.aside .aside-link-op    { font-size: 0.86rem; padding: 6px 10px; }
aside.aside .aside-link-op .aside-link-label { font-weight: 400; }

/* Mobile: aside becomes a sticky top bar with collapsible nav. */
@media (max-width: 879px) {
  aside.aside {
    position: sticky;
    top: 0;
    width: 100%;
    min-height: 0;
    padding: 12px 14px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: column;
  }
  aside.aside .aside-toggle { display: flex; }
  aside.aside .aside-nav { display: none; }
  aside.aside.open .aside-nav { display: flex; }
}
