/* ─────────────────────────────────────────────────────────────────────────────
   Shared application shell — the side panel, the wallpaper and the dark
   palette that the onboarding form, the submissions inbox and the /old
   dashboard all draw from.

   Three surfaces were built separately and looked it. This file is the one
   place their common chrome lives, so a change to the panel or the palette
   lands on all of them at once. Everything here is prefixed `le-` because two
   of those surfaces already own generic class names like `.mesh` and `.card`.

   Loaded from the site root as /shell.css by the two static pages, and
   imported directly by the React app.
   ──────────────────────────────────────────────────────────────────────────── */

/* Dark tokens for pages that only ship a light palette of their own. Pages
   with their own `:root[data-theme="dark"]` block (the onboarding form) load
   this first and override what they care about. */
:root[data-theme="dark"] {
  --canvas: #050B18;
  --glass: rgba(17, 28, 50, .62);
  --glass-strong: rgba(17, 28, 50, .82);
  --border: rgba(120, 160, 230, .18);
  --border-line: rgba(150, 185, 240, .14);
  --ink: #EAF1FC;
  --muted: #93A6C4;
  --faint: #6B7F9E;
  --accent: #3B82F6;
  --accent2: #38BDF8;
  --ok: #34D399;
  --warn: #FBBF24;
  --danger: #FB7185;
  --shadow: 0 24px 70px rgba(0, 0, 0, .55), 0 2px 10px rgba(0, 0, 0, .35);

  color-scheme: dark;
}

/* ── Wallpaper ────────────────────────────────────────────────────────────────
   The same artwork the onboarding form uses, so moving between the panel's
   destinations doesn't feel like moving between products. Fixed, so it stays
   put while a long table scrolls over it. */
.le-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url('/wallpaper.webp') no-repeat center right / cover;
  background-color: var(--canvas);
}
.le-veil {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 60% at 50% 45%, rgba(255, 255, 255, .55), transparent 70%);
}
[data-theme="dark"] .le-mesh {
  background-image: url('/wallpaper-dark.webp');
  background-position: center center;
}
/* The same veil the onboarding form uses, at the same strength. An earlier
   heavier version bought contrast for dashboard tables but hid the artwork
   almost entirely, which is what made /old still read as a different
   product. Contrast is the glass surfaces' job, not the veil's. */
[data-theme="dark"] .le-veil {
  background: radial-gradient(ellipse 78% 68% at 50% 45%, rgba(5, 11, 24, .74), rgba(5, 11, 24, .42) 76%);
}
@media (max-width: 760px) {
  .le-mesh { background-position: center left; }
  [data-theme="dark"] .le-mesh { background-position: center right; }
}

/* ── Side panel ───────────────────────────────────────────────────────────── */

/* On :root, not on .le-shell — `body` reads it, and a custom property only
   inherits downwards. */
:root { --le-panel-w: 248px; }

body.le-has-panel { padding-left: var(--le-panel-w); }

.le-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: var(--le-panel-w);
  height: 100dvh;
  padding: 22px 14px 18px;
  background: var(--glass-strong);
  border-right: 1px solid var(--border-line);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
}

.le-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 20px;
  text-decoration: none;
  color: inherit;
}
.le-brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.le-brand-name { display: block; font-size: 14.5px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.le-brand-sub { display: block; font-size: 11px; color: var(--faint); margin-top: 1px; }

.le-navgroup { margin-bottom: 4px; }
.le-navgroup-label {
  padding: 14px 10px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--faint);
}

.le-nav { display: flex; flex-direction: column; gap: 2px; }

.le-navitem {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .14s ease, color .14s ease, border-color .14s ease;
}
.le-navitem:hover { background: rgba(120, 160, 230, .10); color: var(--ink); }
.le-navitem:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.le-navitem[aria-current="page"] {
  background: linear-gradient(135deg, rgba(59, 130, 246, .20), rgba(56, 189, 248, .10));
  border-color: rgba(120, 160, 230, .28);
  color: var(--ink);
  font-weight: 600;
}
.le-navitem svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.le-navitem[aria-current="page"] svg { stroke: var(--accent2); }

.le-sidebar-foot { margin-top: auto; padding: 14px 10px 0; }

/* ── Theme toggle ─────────────────────────────────────────────────────────── */

.le-theme {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border-line);
  border-radius: 999px;
  background: var(--glass);
  width: fit-content;
}
.le-theme button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
}
.le-theme button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.le-theme button:hover { color: var(--ink); }
.le-theme button[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
}
.le-theme button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Mobile: the panel slides over the content instead of reserving a column
   next to it — 248px out of a phone's width leaves nothing for a table. */

.le-panel-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 40;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border-line);
  border-radius: 12px;
  background: var(--glass-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--ink);
  cursor: pointer;
}
.le-panel-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.le-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(2, 6, 16, .55);
  backdrop-filter: blur(2px);
}

@media (max-width: 900px) {
  body.le-has-panel { padding-left: 0; padding-top: 62px; }
  .le-panel-toggle { display: grid; }
  .le-sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 0 0 60px rgba(0, 0, 0, .5);
  }
  body.le-panel-open .le-sidebar { transform: none; }
  body.le-panel-open .le-scrim { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .le-sidebar { transition: none; }
}
