.nc-layout { min-height: 100vh; }

.nc-app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.nc-header {
  position: sticky;
  top: 0;
  z-index: 300;
  background: var(--nc-near-black);
  border-bottom: 2px solid var(--nc-primary);
}
.nc-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px;
  min-height: 56px;
}
.nc-header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}
.nc-header-accent { color: var(--nc-primary-light); font-weight: 600; }
.nc-header-actions { display: flex; align-items: center; gap: 12px; color: var(--nc-muted); font-size: 14px; }
.nc-header-link { color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; }
.nc-header-user { font-size: 13px; color: var(--nc-muted); }

/* Theme toggle button */
.nc-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}
.nc-theme-toggle:hover { background: rgba(255,255,255,0.16); transform: scale(1.1); }
.nc-theme-toggle:active { transform: scale(0.95); }

/* Show sun in dark mode, moon in light mode */
html[data-theme="dark"]   .nc-theme-icon--sun  { display: block; }
html[data-theme="dark"]   .nc-theme-icon--moon { display: none;  }
html[data-theme="light"]  .nc-theme-icon--sun  { display: none;  }
html[data-theme="light"]  .nc-theme-icon--moon { display: block; }
/* system = follow OS */
html[data-theme="system"] .nc-theme-icon--sun  { display: none;  }
html[data-theme="system"] .nc-theme-icon--moon { display: block; }
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] .nc-theme-icon--sun  { display: block; }
  html[data-theme="system"] .nc-theme-icon--moon { display: none;  }
}

.nc-app-body { display: flex; flex: 1; min-height: 0; }

.nc-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--nc-white);
  border-right: 1px solid var(--nc-border);
  padding: 20px 16px;
}
.nc-sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nc-nav-overline {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nc-muted);
  margin: 16px 0 6px;
}
.nc-nav-link {
  display: block;
  padding: 10px 12px;
  border-radius: var(--nc-radius-sm);
  color: var(--nc-dark-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.nc-nav-link:hover { background: rgba(127, 86, 217, 0.08); }
.nc-nav-muted { opacity: 0.55; pointer-events: none; }

.nc-main {
  flex: 1;
  min-width: 0;
  padding: 28px 24px 96px;
  max-width: 1100px;
}
.nc-main-full {
  flex: 1;
  min-width: 0;
  padding: 0;
  width: 100%;
}

.nc-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 400;
  display: none;
  justify-content: space-around;
  align-items: center;
  min-height: calc(56px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--nc-white);
  border-top: 1px solid var(--nc-border);
}
.nc-bottom-link {
  flex: 1;
  text-align: center;
  padding: 14px 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--nc-dark-text);
  text-decoration: none;
}

.nc-mobile-only { display: none; }
.nc-icon-btn {
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-radius: 8px;
  width: 44px;
  height: 44px;
  cursor: pointer;
}

@media (max-width: 900px) {
  .nc-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 500;
    transform: translateX(-100%);
    transition: transform 0.2s ease-out;
    box-shadow: var(--nc-shadow);
  }
  .nc-sidebar.is-open { transform: translateX(0); }
  .nc-mobile-only { display: flex; }
  .nc-bottom-nav { display: flex; }
  .nc-main { padding-bottom: 100px; }
}

.nc-guest {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(127,86,217,0.25), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(81,47,155,0.35), transparent 50%),
    #0a0a14;
}
html[data-theme="light"] .nc-guest {
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(127,86,217,0.10), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(81,47,155,0.08), transparent 50%),
    #f5f3fa;
}
.nc-guest-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* Guest theme toggle */
.nc-guest-theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  z-index: 100;
}
html[data-theme="light"] .nc-guest-theme-toggle {
  border-color: rgba(0,0,0,0.12);
  background: rgba(127,86,217,0.08);
  color: #512F9B;
}
.nc-guest-theme-toggle:hover { transform: scale(1.1); }
.nc-guest-theme-toggle:active { transform: scale(0.95); }

.nc-admin-shell { display: flex; min-height: 100vh; }
.nc-admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--nc-near-black);
  color: #fff;
  padding: 20px 14px;
}
.nc-admin-brand { font-weight: 800; margin-bottom: 16px; color: var(--nc-primary-light); }
.nc-admin-nav { display: flex; flex-direction: column; gap: 6px; }
.nc-admin-nav a {
  color: #e8e8f0;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 6px;
}
.nc-admin-nav a:hover { background: rgba(255,255,255,0.08); }
.nc-admin-main { flex: 1; padding: 24px; background: var(--nc-bg); }
.nc-admin-page { max-width: 1100px; }
.nc-admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.nc-admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }

@media (max-width: 700px) {
  .nc-admin-shell { flex-direction: column; }
  .nc-admin-sidebar { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
}
