/* Authenticated application shell */
body.app-layout {
  background-color: var(--color-background);
  background-image:
    radial-gradient(ellipse 70% 40% at 100% 0%, rgba(26, 61, 43, 0.06), transparent 55%),
    var(--pattern-geo);
  background-size: auto, var(--pattern-size);
  background-attachment: fixed;
}
.app-shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-width);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--color-sidebar) 92%, var(--color-primary)) 0%, var(--color-sidebar) 45%, color-mix(in srgb, var(--color-sidebar) 90%, #000) 100%);
  color: var(--color-sidebar-text);
  display: none;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: var(--space-5) var(--space-4);
  z-index: 40;
  flex-shrink: 0;
  box-shadow: inset -1px 0 0 rgba(201, 146, 42, 0.12);
}
@media (min-width: 960px) {
  .sidebar.desktop-only { display: flex; }
}
.sidebar-nav { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.sidebar-brand {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.35rem 0.4rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 1.1rem;
}
.brand-mark {
  width: 2.75rem; height: 2.75rem; border-radius: 0.8rem;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #f4efe6 0%, #e8dfd0 100%);
  color: var(--color-primary);
  font-weight: 700; font-family: var(--font-display);
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow:
    0 0 0 2px rgba(201, 146, 42, 0.65),
    0 6px 14px rgba(0, 0, 0, 0.22);
  letter-spacing: -0.02em;
}
.sidebar-brand strong {
  display: block;
  font-size: 1rem;
  line-height: 1.2;
  font-family: var(--font-display);
  letter-spacing: -0.015em;
}
.sidebar-brand small { color: var(--color-sidebar-muted); font-size: 0.75rem; }
.nav-list { list-style: none; overflow-y: auto; flex: 1; padding-right: 0.15rem; }
.nav-list li + li { margin-top: 0.15rem; }
.nav-link, .sidebar-link {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-md);
  color: var(--color-sidebar-text);
  text-decoration: none;
  font-size: 0.925rem;
  font-weight: 500;
}
.nav-link:hover, .sidebar-link:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}
.nav-link.is-active, .sidebar-link.is-active {
  background: var(--color-sidebar-active);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--color-accent);
}
.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: grid; gap: 0.45rem;
}
.sidebar-footer .nav-link { font-size: 0.85rem; opacity: 0.92; }
.user-chip { margin: 0.35rem 0 0; font-size: 0.8rem; color: var(--color-sidebar-muted); }

.app-main {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}
.app-topbar {
  position: sticky; top: 0; z-index: 30;
  min-height: var(--topbar-height);
  background: color-mix(in srgb, var(--color-surface) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.85rem 1.25rem;
}
.page-title { font-size: 1.25rem; margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.app-content {
  padding: 1.25rem;
  width: min(1200px, 100%);
  max-width: 100%;
  margin: 0 auto;
  overflow-x: clip;
  box-sizing: border-box;
}
@media (min-width: 960px) {
  .app-content { padding: 1.75rem 2rem 2.5rem; }
}

/* Mobile drawer */
.drawer-toggle {
  position: fixed; top: 0.85rem; left: 0.85rem; z-index: 60;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.75rem;
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}
.no-desktop { display: inline-flex; }
.desktop-only { display: none; }
@media (min-width: 960px) {
  .no-desktop { display: none !important; }
  .desktop-only { display: flex; }
}
.drawer {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(14, 36, 24, 0.5);
  opacity: 0; visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.drawer.is-open { opacity: 1; visibility: visible; }
.drawer-panel {
  width: min(20rem, 88vw);
  height: 100%;
  background: linear-gradient(180deg, var(--color-sidebar), color-mix(in srgb, var(--color-sidebar) 90%, #000));
  color: var(--color-sidebar-text);
  padding: var(--space-5) var(--space-4);
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  overflow-y: auto;
  box-shadow: inset -1px 0 0 rgba(201, 146, 42, 0.12);
}
.drawer.is-open .drawer-panel { transform: translateX(0); }

/* Guest / auth shell — full-bleed sand + geometric atmosphere */
body.guest-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-background);
  background-image:
    radial-gradient(ellipse 90% 60% at 0% 0%, rgba(26, 61, 43, 0.16), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 0%, rgba(201, 146, 42, 0.14), transparent 50%),
    radial-gradient(ellipse 60% 45% at 50% 110%, rgba(61, 107, 88, 0.1), transparent 55%),
    var(--pattern-geo);
  background-size: auto, auto, auto, var(--pattern-size);
  background-attachment: fixed;
}
.site-header {
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 80%, transparent);
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  backdrop-filter: blur(10px);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.95rem 0;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.header-nav { display: flex; align-items: center; gap: 0.85rem; }
.header-nav > a:not(.btn) {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 550;
}
.header-nav > a:not(.btn):hover { color: var(--color-primary); }
.guest-main { flex: 1; padding: 2rem 0 3rem; }
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.25rem 0;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  background: color-mix(in srgb, var(--color-surface) 70%, transparent);
}
.auth-split {
  display: grid;
  gap: 2rem;
  align-items: center;
}
@media (min-width: 900px) {
  .auth-split { grid-template-columns: 1.05fr 0.95fr; gap: 3rem; min-height: 70vh; }
}
.auth-hero {
  padding: 1.5rem 0.5rem;
}
.auth-hero h1 {
  font-size: clamp(1.9rem, 3.2vw, 2.55rem);
  margin-bottom: 0.75rem;
  color: var(--color-text);
}
.auth-hero p { color: var(--color-text-muted); max-width: 34rem; font-size: 1.05rem; }
.auth-points { list-style: none; margin-top: 1.5rem; display: grid; gap: 0.65rem; }
.auth-points li {
  display: flex; gap: 0.65rem; align-items: flex-start;
  color: var(--color-text-muted); font-size: 0.95rem;
}
.auth-points li::before {
  content: "";
  width: 0.55rem; height: 0.55rem; margin-top: 0.45rem;
  border-radius: 2px;
  background: var(--color-accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-accent) 30%, transparent);
  flex-shrink: 0;
}

/* Brand-forward kickers (landing + auth heroes) */
.brand-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-primary);
  letter-spacing: 0.01em;
}
.brand-kicker .brand-mark,
.auth-hero .brand-mark {
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.1rem;
  background: linear-gradient(145deg, var(--color-primary), var(--color-primary-hover));
  color: #fff;
  box-shadow: inset 0 0 0 2px rgba(201, 146, 42, 0.55), 0 4px 12px rgba(26, 61, 43, 0.2);
}
.landing-hero {
  padding: clamp(1.5rem, 4vw, 2.75rem) 0 0.5rem;
}
.landing-hero h1 {
  font-size: clamp(2rem, 4.2vw, 3rem);
  max-width: 16ch;
  margin-bottom: 0.85rem;
}
.landing-hero .auth-hero > p {
  font-size: 1.1rem;
  max-width: 36rem;
  color: var(--color-text-muted);
}
