/* ==========================================================================
   Layout — splash, sign-in, application shell, responsive drawer
   ========================================================================== */

/* ── Splash / loading screen ─────────────────────────── */
.splash {
  position: fixed; inset: 0; z-index: 2000;
  display: grid; place-items: center;
  background: var(--forest-900) url('../img/pattern.svg') center / 56px repeat;
  transition: opacity .45s var(--ease), visibility .45s;
}
.splash::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, rgba(6,42,28,.35), var(--forest-950) 70%); }
.splash.is-hidden { opacity: 0; visibility: hidden; }
.splash-inner { position: relative; display: grid; justify-items: center; gap: 22px; text-align: center; color: #e9f1ec; padding: 24px; }
.splash-emblem { width: 120px; height: 120px; border-radius: 50%; background: #fff; padding: 8px; box-shadow: 0 0 0 6px rgba(217,192,138,.18), 0 20px 50px rgba(0,0,0,.4); animation: emblem-in .9s var(--ease) both; }
.splash-title { font-size: 22px; font-weight: 750; letter-spacing: -0.01em; }
.splash-sub { font-size: var(--fs-sm); color: #a9bdb2; margin-top: -14px; }
.splash-bar { width: 220px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.splash-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-300), #fff); transition: width .35s var(--ease); }
.splash-status { font-size: var(--fs-xs); color: #8fa69a; min-height: 16px; }
@keyframes emblem-in { from { transform: scale(.85) rotate(-25deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Sign-in & first-time setup ──────────────────────── */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(380px, .95fr);
  background: var(--surface);
}
.auth-brand {
  position: relative; overflow: hidden; color: #e9f1ec;
  background: var(--forest-900) url('../img/pattern.svg') center / 56px repeat;
  display: flex; flex-direction: column; justify-content: space-between; padding: 48px 56px;
}
.auth-brand::before { content: ''; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(4,29,19,.55), rgba(4,29,19,.95) 70%); }
.auth-brand > * { position: relative; }
.auth-brand .emblem-ring { width: 340px; height: 340px; position: absolute; right: -90px; bottom: -90px; opacity: .1; border-radius: 50%; background: #fff url('../img/emblem.png') center / 92% no-repeat; }
.auth-logo { display: flex; align-items: center; gap: 14px; }
.auth-logo img { width: 52px; height: 52px; border-radius: 50%; background: #fff; padding: 3px; }
.auth-logo strong { display: block; font-size: 17px; letter-spacing: .02em; }
.auth-logo span { font-size: var(--fs-sm); color: #a9bdb2; }
.auth-pitch { max-width: 460px; }
.auth-pitch h1 { font-size: 40px; line-height: 1.1; letter-spacing: -0.03em; color: #fff; }
.auth-pitch p { margin-top: 16px; color: #b9cbc1; font-size: var(--fs-lg); line-height: 1.6; }
.auth-teams { display: flex; flex-wrap: wrap; gap: 10px; }
.auth-teams span { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--r-pill); background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); font-size: var(--fs-sm); }
.auth-teams i { width: 8px; height: 8px; border-radius: 50%; }
.auth-form-wrap { display: grid; place-items: center; padding: 40px 24px; }
.auth-form { width: min(380px, 100%); display: grid; gap: 18px; }
.auth-form h2 { font-size: var(--fs-2xl); letter-spacing: -0.02em; }
.auth-form .lead { color: var(--muted); margin-top: -8px; }
.auth-error { padding: 10px 12px; border-radius: var(--r-sm); background: var(--bad-bg); color: var(--bad); font-size: var(--fs-sm); font-weight: 600; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 28px 24px; min-height: 220px; gap: 24px; }
  .auth-pitch h1 { font-size: 28px; }
  .auth-pitch p, .auth-teams { display: none; }
  .auth-brand .emblem-ring { width: 220px; height: 220px; right: -60px; bottom: -80px; }
}

/* ── Application shell ───────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  color: #cfdcd5;
  background: var(--forest-900);
  border-right: 1px solid var(--forest-800);
  scrollbar-width: thin; scrollbar-color: var(--forest-800) transparent;
}
.sidebar::after {
  content: ''; position: absolute; inset: auto 0 0 0; height: 220px; pointer-events: none;
  background: url('../img/pattern.svg') center / 56px repeat;
  mask-image: linear-gradient(to top, rgba(0,0,0,.22), transparent);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,.22), transparent);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar-brand img { width: 42px; height: 42px; border-radius: 50%; background: #fff; padding: 2px; flex: none; }
.sidebar-brand strong { display: block; color: #fff; font-size: 14.5px; line-height: 1.2; }
.sidebar-brand span { font-size: var(--fs-xs); color: #8fa69a; }

.nav { position: relative; z-index: 1; padding: 12px 12px 24px; display: grid; gap: 2px; }
.nav-group { margin: 16px 10px 6px; font-size: var(--fs-xs); font-weight: 650; color: #7f978b; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 8px;
  color: #cfdcd5; text-decoration: none; font-size: var(--fs-md); font-weight: 560;
  transition: background .15s, color .15s;
}
.nav-link svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link[aria-current='page'] { background: rgba(217,192,138,.13); color: #fff; box-shadow: inset 3px 0 0 var(--gold-300); }
.nav-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin: 0 4px; box-shadow: 0 0 0 2px rgba(255,255,255,.08); }
.nav-meta { margin-left: auto; font-size: var(--fs-xs); color: #8fa69a; }
.nav-team-sub { padding-left: 34px; font-size: var(--fs-sm); }

.sidebar-foot { position: relative; z-index: 1; margin-top: auto; padding: 14px 16px 18px; border-top: 1px solid rgba(255,255,255,.06); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 750; font-size: 13px; color: var(--forest-900); background: var(--gold-300); }
.user-chip strong { display: block; color: #fff; font-size: var(--fs-sm); line-height: 1.25; }
.user-chip span { font-size: var(--fs-xs); color: #8fa69a; }
.user-chip .btn { margin-left: auto; color: #cfdcd5; }
.user-chip .btn:hover { background: rgba(255,255,255,.08); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 28px; background: rgba(242,245,242,.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: var(--fs-lg); font-weight: 700; }
.topbar-crumb { font-size: var(--fs-sm); color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.menu-toggle { display: none; }

.content { padding: 24px 28px 48px; width: 100%; max-width: 1480px; margin: 0 auto; display: grid; gap: 20px; align-content: start; }
.app-footer { margin-top: auto; padding: 18px 28px; font-size: var(--fs-xs); color: var(--faint); border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Drawer behaviour on tablets and phones */
.scrim { display: none; }
@media (max-width: 1080px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .28s var(--ease); box-shadow: var(--shadow-pop); }
  .shell.drawer-open .sidebar { transform: none; }
  .shell.drawer-open .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(4,29,19,.45); }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 40px; }
}
@media (max-width: 640px) {
  .topbar-crumb, .topbar .hide-sm { display: none; }
  .content { padding: 14px 12px 36px; gap: 14px; }
  h1 { font-size: 22px; }
}
